compilerr
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -23,3 +23,3 @@ { | ||
}, | ||
"version": "0.2.0" | ||
"version": "0.3.0" | ||
} |
@@ -83,3 +83,4 @@ 'use strict'; | ||
if (arguments.length === 2 && parameters instanceof Error) { | ||
if (arguments.length === 2 && | ||
(parameters instanceof Error || (parameters.code !== undefined && parameters.code.slice(-9) === 'Exception'))) { | ||
cause = parameters; | ||
@@ -86,0 +87,0 @@ } |
@@ -122,3 +122,3 @@ 'use strict'; | ||
it('should return an error with a given cause as a third argument', function () { | ||
it('should return an error with a given cause as a second argument', function () { | ||
var cause, | ||
@@ -136,4 +136,19 @@ err; | ||
it('should return an error with a given AWS style exception as a second argument', function () { | ||
var cause, | ||
err; | ||
cause = { | ||
code: 'SomeCrazyException' | ||
}; | ||
err = compilerr.compile({}, cause); | ||
expect(err).to.be.an.instanceOf(Error); | ||
expect(err.cause).to.equal(cause); | ||
}); | ||
}); | ||
}); |
11370
384