fix: Only apply captureStackTrace if it exists on the error object

This commit is contained in:
Blade Barringer
2016-05-12 18:57:49 -05:00
parent e47ae45f9f
commit de1f2c2788

View File

@@ -5,9 +5,12 @@ import extendableBuiltin from './extendableBuiltin';
export class CustomError extends extendableBuiltin(Error) {
constructor () {
super();
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
}
}
// We specify an httpCode for all errors so that they can be used in the API too