* This function removes unnecessary frames from Node.js core errors. * @template {(...args: unknown[]) => unknown} T * @param {T} fn * @returns {T}
(fn)
| 538 | * @returns {T} |
| 539 | */ |
| 540 | function hideStackFrames(fn) { |
| 541 | function wrappedFn(...args) { |
| 542 | try { |
| 543 | return ReflectApply(fn, this, args); |
| 544 | } catch (error) { |
| 545 | Error.stackTraceLimit && ErrorCaptureStackTrace(error, wrappedFn); |
| 546 | throw error; |
| 547 | } |
| 548 | } |
| 549 | wrappedFn.withoutStackTrace = fn; |
| 550 | return wrappedFn; |
| 551 | } |
| 552 | |
| 553 | // Utility function for registering the error codes. Only used here. Exported |
| 554 | // *only* to allow for testing. |
no outgoing calls
no test coverage detected
searching dependent graphs…