From: Jérôme Benoit Date: Tue, 8 Feb 2022 13:39:12 +0000 (+0100) Subject: Silence one code smell X-Git-Tag: v1.1.46~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=35efcc3a2921eebb5bcb1c00b95f656e1b777058;p=e-mobility-charging-stations-simulator.git Silence one code smell Signed-off-by: Jérôme Benoit --- diff --git a/src/exception/BaseError.ts b/src/exception/BaseError.ts index e1a82c00..ad78e261 100644 --- a/src/exception/BaseError.ts +++ b/src/exception/BaseError.ts @@ -3,6 +3,10 @@ export default class BaseError extends Error { super(message); this.name = new.target.name; Object.setPrototypeOf(this, new.target.prototype); - Error.captureStackTrace ? (Error.captureStackTrace(this, this.constructor)) : (this.stack = (new Error()).stack); + Error.captureStackTrace ? (Error.captureStackTrace(this, this.constructor)) : (this.createStack()); + } + + private createStack(): void { + this.stack = new Error().stack; } }