diff options
author | Maciej MaĆecki <maciej.malecki@notimplemented.org> | 2012-04-29 15:17:16 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-04-29 22:27:45 +0200 |
commit | 77c18d1e1b470d99af317a2b1ed4b7e9bb81d5b6 (patch) | |
tree | 3780d3659cc7d9f349315c4adfdaf35d15c15a3e /lib/console.js | |
parent | 3bcbd14bb18b444851b5f6c2cfdacea6403a694f (diff) | |
download | android-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.js | 6 |
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); }; |