Skip to content

Commit 4be1d35

Browse files
authored
Emscripten: Only call DumpTraceback if it exists (#160305)
Prevents an error-inside-of-error situation. Since we know that something has gone wrong already, the runtime might be in a bad state.
1 parent ad101c3 commit 4be1d35

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎Platforms/emscripten/node_entry.mjs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ try {
5757
// Show JavaScript exception and traceback
5858
console.warn(e);
5959
// Show Python exception and traceback
60-
Module.PyUnstable_DumpTraceback(2, Module._PyGILState_GetThisThreadState());
60+
try {
61+
Module.PyUnstable_DumpTraceback?.(2, Module._PyGILState_GetThisThreadState());
62+
} catch(e) {
63+
console.warn("Error occurred while attempting to format a Python traceback:");
64+
console.warn(e);
65+
}
6166
process.exit(1);
6267
}

0 commit comments

Comments
 (0)