callback-timeout
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,9 +0,10 @@ | ||
var inherits = require('util').inherits | ||
var inherits = require('util').inherits, | ||
captureStackTrace = require('capture-stack-trace') | ||
module.exports.TimeoutError = TimeoutError | ||
function TimeoutError (message) { | ||
Error.captureStackTrace(this, TimeoutError) | ||
this.name = 'TimeoutError' | ||
captureStackTrace(this, TimeoutError) | ||
this.name = this.constructor.name | ||
this.message = message | ||
} | ||
inherits(TimeoutError, Error) |
{ | ||
"name": "callback-timeout", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Invokes callback with single error argument if timeout occurs before it's invoked by other means", | ||
@@ -37,3 +37,5 @@ "main": "index.js", | ||
"license": "MIT", | ||
"dependencies": {} | ||
"dependencies": { | ||
"capture-stack-trace": "~1.0.0" | ||
} | ||
} |
var test = require('tape'), | ||
timeout = require('..') | ||
test(function (t) { | ||
test('with error message provided', function (t) { | ||
t.plan(3) | ||
@@ -6,0 +6,0 @@ |
var test = require('tape'), | ||
timeout = require('..') | ||
test(function (t) { | ||
test('with no timeout given', function (t) { | ||
t.plan(3) | ||
@@ -6,0 +6,0 @@ |
@@ -5,4 +5,4 @@ var test = require('tape'), | ||
test(function (t) { | ||
t.plan(4) | ||
test('with timeouts given', function (t) { | ||
t.plan(5) | ||
@@ -29,4 +29,5 @@ function doSomethingFast (cb) { setTimeout(cb, 100) } | ||
t.ok(err instanceof TimeoutError, 'error is a TimeoutError') | ||
t.equals(err.name, 'TimeoutError', 'error.name is TimeoutError') | ||
}, 250)) | ||
}) | ||
11208
14
121
1
+ Addedcapture-stack-trace@~1.0.0
+ Addedcapture-stack-trace@1.0.2(transitive)