X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fexception%2FBaseError.ts;h=6b9ea70fd914de381f4bf90a82abd9778dc8c9fd;hb=a01134ed215b62a0c82475b9fbb35306fa792bbc;hp=84421eac143b3db6440fd74cb2c8fc6ed8ec3eee;hpb=268a74bb051fcbbad532fd833f0d8fd2b33b6c64;p=e-mobility-charging-stations-simulator.git diff --git a/src/exception/BaseError.ts b/src/exception/BaseError.ts index 84421eac..6b9ea70f 100644 --- a/src/exception/BaseError.ts +++ b/src/exception/BaseError.ts @@ -1,12 +1,14 @@ export class BaseError extends Error { - public constructor(message?: string) { - super(message); - this.name = new.target.name; - Object.setPrototypeOf(this, new.target.prototype); - Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.createStack(); + public constructor (message?: string) { + super(message) + this.name = new.target.name + Object.setPrototypeOf(this, new.target.prototype) + typeof Error.captureStackTrace === 'function' + ? Error.captureStackTrace(this, this.constructor) + : this.createStack() } - private createStack(): void { - this.stack = new Error().stack; + private createStack (): void { + this.stack = new Error().stack } }