Commit | Line | Data |
---|---|---|
268a74bb | 1 | export class BaseError extends Error { |
e7accadb JB |
2 | public constructor(message?: string) { |
3 | super(message); | |
4 | this.name = new.target.name; | |
5 | Object.setPrototypeOf(this, new.target.prototype); | |
e7aeea18 | 6 | Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.createStack(); |
35efcc3a JB |
7 | } |
8 | ||
9 | private createStack(): void { | |
10 | this.stack = new Error().stack; | |
e7accadb JB |
11 | } |
12 | } |