error-ex
Advanced tools
Comparing version 1.3.1 to 1.3.2
16
index.js
@@ -54,2 +54,4 @@ 'use strict'; | ||
var overwrittenStack = null; | ||
var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack'); | ||
@@ -61,10 +63,16 @@ var stackGetter = stackDescriptor.get; | ||
stackDescriptor.set = function (newstack) { | ||
overwrittenStack = newstack; | ||
}; | ||
stackDescriptor.get = function () { | ||
var stack = (stackGetter) | ||
? stackGetter.call(this).split(/\r?\n+/g) | ||
: stackValue.split(/\r?\n+/g); | ||
var stack = (overwrittenStack || ((stackGetter) | ||
? stackGetter.call(this) | ||
: stackValue)).split(/\r?\n+/g); | ||
// starting in Node 7, the stack builder caches the message. | ||
// just replace it. | ||
stack[0] = this.name + ': ' + this.message; | ||
if (!overwrittenStack) { | ||
stack[0] = this.name + ': ' + this.message; | ||
} | ||
@@ -71,0 +79,0 @@ var lineCount = 1; |
{ | ||
"name": "error-ex", | ||
"description": "Easy error subclassing and stack customization", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"maintainers": [ | ||
@@ -6,0 +6,0 @@ "Josh Junon <i.am.qix@gmail.com> (github.com/qix-)", |
9035
110