Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
fix: stack trace fix attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
gigobyte committed May 9, 2020
1 parent 78b9637 commit e880d5d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export class HttpError extends MWSError {
constructor(public error: unknown, ...parameters: string[]) {
super(...parameters)
Object.setPrototypeOf(this, HttpError.prototype)

if (Error.captureStackTrace) {
Error.captureStackTrace(this, MWSError)
}
}
}

Expand All @@ -29,13 +33,21 @@ export class ParsingError extends MWSError {
constructor(public error: string, ...parameters: string[]) {
super(...parameters)
Object.setPrototypeOf(this, ParsingError.prototype)

if (Error.captureStackTrace) {
Error.captureStackTrace(this, MWSError)
}
}
}

export class BadParameterError extends MWSError {
constructor(public error: string, ...parameters: string[]) {
super(...parameters)
Object.setPrototypeOf(this, BadParameterError.prototype)

if (Error.captureStackTrace) {
Error.captureStackTrace(this, MWSError)
}
}
}
/* eslint-enable max-classes-per-file */

0 comments on commit e880d5d

Please sign in to comment.