summaryrefslogtreecommitdiff
path: root/lib/console.js
diff options
context:
space:
mode:
authorMaciej MaƂecki <maciej.malecki@notimplemented.org>2012-04-29 15:17:16 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2012-04-29 22:27:45 +0200
commit77c18d1e1b470d99af317a2b1ed4b7e9bb81d5b6 (patch)
tree3780d3659cc7d9f349315c4adfdaf35d15c15a3e /lib/console.js
parent3bcbd14bb18b444851b5f6c2cfdacea6403a694f (diff)
downloadandroid-node-v8-77c18d1e1b470d99af317a2b1ed4b7e9bb81d5b6.tar.gz
android-node-v8-77c18d1e1b470d99af317a2b1ed4b7e9bb81d5b6.tar.bz2
android-node-v8-77c18d1e1b470d99af317a2b1ed4b7e9bb81d5b6.zip
console: throw when no such label exists in `console.timeEnd`
Test included.
Diffstat (limited to 'lib/console.js')
-rw-r--r--lib/console.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/console.js b/lib/console.js
index ac8912f828..64d21a4266 100644
--- a/lib/console.js
+++ b/lib/console.js
@@ -49,7 +49,11 @@ exports.time = function(label) {
exports.timeEnd = function(label) {
- var duration = Date.now() - times[label];
+ var time = times[label];
+ if (!time) {
+ throw new Error('No such label: ' + label);
+ }
+ var duration = Date.now() - time;
exports.log('%s: %dms', label, duration);
};