From 8ba80e81564bb7888b23c5abadd15ef4de8b2832 Mon Sep 17 00:00:00 2001 From: ryzetech Date: Wed, 18 Jan 2023 17:36:19 +0100 Subject: [PATCH] oops im stupid --- app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index f7b0322..26ef371 100644 --- a/app.js +++ b/app.js @@ -21,9 +21,11 @@ const cache = new NodeCache({ stdTTL: config.checkperiod * 3 }); })(); async function checkSpace(space) { - const response = await fetch(space.endpoint); - const data = await response.json(); - let open; + let response, data, open; + try { + response = await fetch(space.endpoint); + data = await response.json(); + } catch (e) { console.error(`The space ${space.id} might not be reachable. Please check the endpoint. Error: ${e}`); } if (!space.path) { try { open = data.state.open; }