MCPcopy
hub / github.com/vitejs/vite / rebindErrorStacktrace

Function rebindErrorStacktrace

packages/vite/src/node/ssr/ssrStacktrace.ts:75–90  ·  view source on GitHub ↗
(e: Error, stacktrace: string)

Source from the content-addressed store, hash-verified

73}
74
75export 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
92const rewroteStacktraces = new WeakSet()
93

Callers 1

ssrFixStacktraceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected