Skip to content

Commit 107ab1a

Browse files
committed
fix
1 parent 4444460 commit 107ab1a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/utils/errorTraceHandler.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,17 @@ export async function handleWebAssemblyError(
109109
const wasmBuffer = await readFile(wasmPath);
110110
const sourceMapPath = parseSourceMapPath(wasmBuffer.buffer as ArrayBuffer);
111111
const sourceMapConsumer = sourceMapPath ? await getSourceMapConsumer(sourceMapPath) : null;
112+
let stacks: NodeJS.CallSite[] = [];
112113
const originalPrepareStackTrace = Error.prepareStackTrace;
113-
let stacks: WebAssemblyCallSite[] = [];
114114
Error.prepareStackTrace = (_: Error, structuredStackTrace: NodeJS.CallSite[]) => {
115-
stacks = structuredStackTrace
116-
.map((callSite) => createWebAssemblyCallSite(callSite, { wasmPath, sourceMapConsumer }))
117-
.filter((callSite) => callSite != null);
115+
stacks = structuredStackTrace;
118116
};
119117
error.stack; // trigger prepareStackTrace
120118
Error.prepareStackTrace = originalPrepareStackTrace;
121-
return { message: error.message, stacks };
119+
return {
120+
message: error.message,
121+
stacks: stacks
122+
.map((callSite) => createWebAssemblyCallSite(callSite, { wasmPath, sourceMapConsumer }))
123+
.filter((callSite) => callSite != null),
124+
};
122125
}

0 commit comments

Comments
 (0)