Svelte: Restore printing CX init error messages to the visible console

This commit is contained in:
Alessandro Pignotti 2024-10-14 08:18:32 +02:00
parent 834566aa0e
commit 0a9a044b27
2 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,4 @@
const color= "\x1b[1;35m";
const underline= "\x1b[94;4m";
const normal= "\x1b[0m";
export const introMessage = [
@ -25,5 +26,15 @@ export const introMessage = [
" objdump -d ./helloworld | less -M",
" vim examples/c/helloworld.c",
" curl --max-time 15 parrot.live # requires networking",
"",
""
];
export const errorMessage = [
color + "CheerpX could not start" + normal,
"",
"CheerpX is expected to work with recent desktop versions of Chrome, Edge, Firefox and Safari",
"",
"Give it a try from a desktop version / another browser!",
"",
"CheerpX internal error message is:",
""
];

View file

@ -12,7 +12,7 @@
import '@fortawesome/fontawesome-free/css/all.min.css'
import { networkInterface, startLogin } from '$lib/network.js'
import { cpuActivity, diskActivity } from '$lib/activities.js'
import { introMessage } from '$lib/messages.js'
import { introMessage, errorMessage } from '$lib/messages.js'
var term = new Terminal({cursorBlink:true, convertEol:true, fontFamily:"monospace", fontWeight: 400, fontWeightBold: 700});
var cx = null;
@ -124,8 +124,9 @@
}
catch(e)
{
// TODO: Print error message on console
throw e;
printMessage(errorMessage);
printMessage([e.toString()]);
return;
}
cx.registerCallback("cpuActivity", cpuCallback);
cx.registerCallback("diskActivity", hddCallback);