make-error-cause
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -14,2 +14,6 @@ "use strict"; | ||
var makeError = require("make-error"); | ||
/** | ||
* @internal | ||
*/ | ||
exports.SEPARATOR_TEXT = "\n\nThe following exception was the direct cause of the above exception:\n\n"; | ||
var BaseError = /** @class */ (function (_super) { | ||
@@ -32,3 +36,4 @@ __extends(BaseError, _super); | ||
while (err) { | ||
fullStack = err.stack + "\n\nDuring the above error, another error occurred:\n\n" + fullStack; | ||
fullStack += exports.SEPARATOR_TEXT; | ||
fullStack += err.stack || err.message; | ||
err = err.cause; | ||
@@ -35,0 +40,0 @@ } |
@@ -16,3 +16,2 @@ "use strict"; | ||
var index_1 = require("./index"); | ||
var SEP_TEXT = '\n\nDuring the above error, another error occurred:\n\n'; | ||
test('make error cause', function (t) { | ||
@@ -40,3 +39,3 @@ var TestError = /** @class */ (function (_super) { | ||
t.equal(testError.cause, cause); | ||
t.equal(index_1.fullStack(testError), "" + cause.stack + SEP_TEXT + testError.stack); | ||
t.equal(index_1.fullStack(testError), "" + testError.stack + index_1.SEPARATOR_TEXT + cause.stack); | ||
t.equal(util_1.inspect(testError), index_1.fullStack(testError)); | ||
@@ -47,3 +46,3 @@ t.ok(testError instanceof Error); | ||
t.equal(subTestError.cause, testError); | ||
t.equal(index_1.fullStack(subTestError), "" + cause.stack + SEP_TEXT + testError.stack + SEP_TEXT + subTestError.stack); | ||
t.equal(index_1.fullStack(subTestError), "" + subTestError.stack + index_1.SEPARATOR_TEXT + testError.stack + index_1.SEPARATOR_TEXT + cause.stack); | ||
t.equal(util_1.inspect(subTestError), index_1.fullStack(subTestError)); | ||
@@ -50,0 +49,0 @@ t.ok(subTestError instanceof Error); |
{ | ||
"name": "make-error-cause", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Make your own nested error types!", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12753
101