mirror of https://github.com/pyodide/pyodide.git
Print fatal error message when the fatal error occurs (#1311)
This commit is contained in:
parent
ab249a0a50
commit
de7c342010
|
@ -383,8 +383,10 @@ globalThis.languagePluginLoader = (async () => {
|
|||
Module.noWasmDecoding =
|
||||
false; // we preload wasm using the built in plugin now
|
||||
Module.preloadedWasm = {};
|
||||
let isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
|
||||
let fatal_error_msg =
|
||||
"Pyodide has suffered a fatal error, refresh the page. " +
|
||||
"Please report this to the Pyodide maintainers.";
|
||||
Module.fatal_error = function(e) {
|
||||
for (let [key, value] of Object.entries(Module.public_api)) {
|
||||
if (key.startsWith("_")) {
|
||||
|
@ -397,12 +399,11 @@ globalThis.languagePluginLoader = (async () => {
|
|||
continue;
|
||||
}
|
||||
if (typeof (value) === "function") {
|
||||
Module.public_api[key] = function() {
|
||||
throw Error("Pyodide has suffered a fatal error, refresh the page. " +
|
||||
"Please report this to the Pyodide maintainers.");
|
||||
}
|
||||
Module.public_api[key] = function() { throw Error(fatal_error_msg); }
|
||||
}
|
||||
}
|
||||
console.error(fatal_error_msg);
|
||||
console.error("The cause of the fatal error was:\n", e);
|
||||
throw e;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue