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