Function
rebindErrorStacktrace
(e: Error, stacktrace: string)
Source from the content-addressed store, hash-verified
| 73 | } |
| 74 | |
| 75 | export function rebindErrorStacktrace(e: Error, stacktrace: string): void { |
| 76 | const { configurable, writable } = Object.getOwnPropertyDescriptor( |
| 77 | e, |
| 78 | 'stack', |
| 79 | )! |
| 80 | if (configurable) { |
| 81 | Object.defineProperty(e, 'stack', { |
| 82 | value: stacktrace, |
| 83 | enumerable: true, |
| 84 | configurable: true, |
| 85 | writable: true, |
| 86 | }) |
| 87 | } else if (writable) { |
| 88 | e.stack = stacktrace |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | const rewroteStacktraces = new WeakSet() |
| 93 | |
Tested by
no test coverage detected