Comparing version 1.5.1 to 1.6.0
@@ -39,4 +39,16 @@ /* | ||
{ | ||
var args, causedBy, ctor, tailmsg; | ||
var args, obj, causedBy, ctor, tailmsg; | ||
/* | ||
* This is a regrettable pattern, but JavaScript's built-in Error class | ||
* is defined to work this way, so we allow the constructor to be called | ||
* without "new". | ||
*/ | ||
if (!(this instanceof VError)) { | ||
args = Array.prototype.slice.call(arguments, 0); | ||
obj = Object.create(VError.prototype); | ||
VError.apply(obj, arguments); | ||
return (obj); | ||
} | ||
if (options instanceof Error || typeof (options) === 'object') { | ||
@@ -105,2 +117,4 @@ args = Array.prototype.slice.call(arguments, 1); | ||
} | ||
return (this); | ||
} | ||
@@ -107,0 +121,0 @@ |
{ | ||
"name": "verror", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "richer JavaScript errors", | ||
@@ -5,0 +5,0 @@ "main": "./lib/verror.js", |
@@ -163,1 +163,8 @@ /* | ||
mod_assert.equal('my undefined string', err.message); | ||
/* invoked without "new" */ | ||
err = VError('my %s string', 'testing!'); | ||
mod_assert.equal(err.name, 'VError'); | ||
mod_assert.ok(err instanceof VError); | ||
mod_assert.ok(err instanceof Error); | ||
mod_assert.equal(err.message, 'my testing! string'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50826
806