mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
fix: Only apply captureStackTrace if it exists on the error object
This commit is contained in:
@@ -5,8 +5,11 @@ import extendableBuiltin from './extendableBuiltin';
|
|||||||
export class CustomError extends extendableBuiltin(Error) {
|
export class CustomError extends extendableBuiltin(Error) {
|
||||||
constructor () {
|
constructor () {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
if (Error.captureStackTrace) {
|
||||||
Error.captureStackTrace(this, this.constructor);
|
Error.captureStackTrace(this, this.constructor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We specify an httpCode for all errors so that they can be used in the API too
|
// We specify an httpCode for all errors so that they can be used in the API too
|
||||||
|
|||||||
Reference in New Issue
Block a user