summaryrefslogtreecommitdiff
path: root/src/static
diff options
context:
space:
mode:
Diffstat (limited to 'src/static')
-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