punch-error
Advanced tools
Comparing version 1.0.1 to 1.0.2
17
index.js
@@ -18,3 +18,3 @@ 'use strict'; | ||
this.message = message; | ||
this.status = config.status; | ||
this.status = config.status || 500; | ||
if (typeof Error.captureStackTrace === 'function') { | ||
@@ -64,4 +64,7 @@ Error.captureStackTrace(this, this.constructor); | ||
newError.history = (newError.history && newError.history.slice()) || []; | ||
if (err) newError.history.push(err); | ||
if (err) { | ||
newError.history = (err.history && err.history.slice()) | ||
newError.history.push(err); | ||
} | ||
else newError.history = []; | ||
@@ -76,4 +79,8 @@ return newError; | ||
const newError = new this(override); | ||
newError.history = (newError.history && newError.history.slice()) || []; | ||
if (err) newError.history.push(err); | ||
if (err) { | ||
newError.history = (err.history && err.history.slice()) | ||
newError.history.push(err); | ||
} | ||
else newError.history = []; | ||
@@ -80,0 +87,0 @@ return newError; |
{ | ||
"name": "punch-error", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Tomas Savigliano", |
8030
265