repositories
/
e-mobility-charging-stations-simulator.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dd21af1
)
fix: recreate stack trace on BaseError only if needed
author
Jérôme Benoit
<jerome.benoit@sap.com>
Sun, 28 Jan 2024 13:35:30 +0000
(14:35 +0100)
committer
Jérôme Benoit
<jerome.benoit@sap.com>
Sun, 28 Jan 2024 13:35:30 +0000
(14:35 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/exception/BaseError.ts
patch
|
blob
|
blame
|
history
diff --git
a/src/exception/BaseError.ts
b/src/exception/BaseError.ts
index 6b9ea70fd914de381f4bf90a82abd9778dc8c9fd..0f41c331b73aabdcbf12bb6da19ef8a51c6c6cfb 100644
(file)
--- a/
src/exception/BaseError.ts
+++ b/
src/exception/BaseError.ts
@@
-3,12
+3,8
@@
export class BaseError extends Error {
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
+ if (this.stack == null && typeof BaseError.captureStackTrace === 'function') {
+ BaseError.captureStackTrace(this, this.constructor)
+ }
}
}