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,7 +5,10 @@ import extendableBuiltin from './extendableBuiltin';
export class CustomError extends extendableBuiltin(Error) {
constructor () {
super();
Error.captureStackTrace(this, this.constructor);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
}
}