summaryrefslogtreecommitdiff
path: root/src/static/main.js
diff options
context:
space:
mode:
authoruser@node5.net <user@node5.net>2026-07-11 23:14:50 +0200
committeruser@node5.net <user@node5.net>2026-07-11 23:14:50 +0200
commit8b0c5b0a1c36467990481e213bc5cfa1500129d2 (patch)
tree77c39249f82ba5b4668941685cd0748a28365b23 /src/static/main.js
parentd4968aff82ccd9c77fbdf255a73f12e974ef5a76 (diff)
js error - show error in case of non-ok statusHEADmaster
Diffstat (limited to 'src/static/main.js')
-rw-r--r--src/static/main.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/static/main.js b/src/static/main.js
index 12c5e3f..02d20a2 100644
--- a/src/static/main.js
+++ b/src/static/main.js
@@ -4,10 +4,12 @@ async function update() {
programE = document.querySelector("#program");
try {
const response = await fetch("/update");
- if (response.status == 200) {
+ if (response.ok) {
html = await response.text();
topE.innerHTML = html.split("\n").slice(0, 1)[0];
programE.outerHTML = html.split("\n").slice(1).join("\n");
+ } else {
+ throw new Error(`Response status: ${response.status}`);
}
} catch (err) {
// Happens when the server is closed / unreachable