未验证 提交 181bf6c9 编写于 作者: G GitSquared

Add error handling - closes #42

上级 2e7a38ed
...@@ -34,6 +34,11 @@ window.theme = { ...@@ -34,6 +34,11 @@ window.theme = {
b: theme.colors.blue b: theme.colors.blue
}; };
// Initiate basic error handling
window.onerror = (msg, path, line, col, error) => {
document.getElementById("boot_screen").innerHTML += `${error} : ${msg}<br/>==> at ${path} ${line}:${col}`;
};
// Startup boot log // Startup boot log
let resumeInit, initUI, initMods; let resumeInit, initUI, initMods;
let bootScreen = document.getElementById("boot_screen"); let bootScreen = document.getElementById("boot_screen");
...@@ -94,6 +99,14 @@ resumeInit = () => { ...@@ -94,6 +99,14 @@ resumeInit = () => {
setTimeout(() => { setTimeout(() => {
title.setAttribute("style", `border: 5px solid rgb(${window.theme.r}, ${window.theme.g}, ${window.theme.b});`); title.setAttribute("style", `border: 5px solid rgb(${window.theme.r}, ${window.theme.g}, ${window.theme.b});`);
setTimeout(() => { setTimeout(() => {
// Initiate graphical error display
window.onerror = (msg, path, line, col, error) => {
new Modal({
type: "error",
title: error,
message: `${msg}<br/> at ${path} ${line}:${col}`
});
};
document.getElementById("boot_screen").remove(); document.getElementById("boot_screen").remove();
initUI(); initUI();
}, 1200); }, 1200);
...@@ -179,3 +192,7 @@ window.onkeydown = (e) => { ...@@ -179,3 +192,7 @@ window.onkeydown = (e) => {
e.preventDefault(); e.preventDefault();
} }
}; };
// Prevent losing hardware keyboard focus on the terminal when using touch keyboard
window.onmouseup = (e) => {
window.term.term.focus();
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册