chore: switch coding style to JS standard
[e-mobility-charging-stations-simulator.git] / src / exception / BaseError.ts
1 export class BaseError extends Error {
2 public constructor (message?: string) {
3 super(message)
4 this.name = new.target.name
5 Object.setPrototypeOf(this, new.target.prototype)
6 typeof Error.captureStackTrace === 'function'
7 ? Error.captureStackTrace(this, this.constructor)
8 : this.createStack()
9 }
10
11 private createStack (): void {
12 this.stack = new Error().stack
13 }
14 }