Catch unexpected errors and raise them to the console
This commit is contained in:
parent
e4b9b50072
commit
86d4477e1c
2 changed files with 21 additions and 2 deletions
|
@ -7,7 +7,7 @@
|
|||
import '@fortawesome/fontawesome-free/css/all.min.css'
|
||||
import { networkInterface, startLogin } from '$lib/network.js'
|
||||
import { cpuActivity, diskActivity, cpuPercentage, diskLatency } from '$lib/activities.js'
|
||||
import { introMessage, errorMessage } from '$lib/messages.js'
|
||||
import { introMessage, errorMessage, unexpectedErrorMessage } from '$lib/messages.js'
|
||||
|
||||
export let configObj = null;
|
||||
export let processCallback = null;
|
||||
|
@ -156,7 +156,16 @@
|
|||
consoleDiv.addEventListener("drop", preventDefaults, false);
|
||||
if(configObj.printIntro)
|
||||
printMessage(introMessage);
|
||||
initCheerpX();
|
||||
try
|
||||
{
|
||||
await initCheerpX();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
printMessage(unexpectedErrorMessage);
|
||||
printMessage([e.toString()]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
function handleActivateConsole(vt)
|
||||
{
|
||||
|
|
|
@ -38,3 +38,13 @@ export const errorMessage = [
|
|||
"CheerpX internal error message is:",
|
||||
""
|
||||
];
|
||||
export const unexpectedErrorMessage = [
|
||||
color + "WebVM encountered an unexpected error" + normal,
|
||||
"",
|
||||
"Check the DevTools console for further information",
|
||||
"",
|
||||
"Please consider reporting a bug!",
|
||||
"",
|
||||
"CheerpX internal error message is:",
|
||||
""
|
||||
];
|
||||
|
|
Loading…
Add table
Reference in a new issue