From 1d365ea3740a38d5b9e582731dd57b40faa8a8fe Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 21:29:51 +0100 Subject: [PATCH] Fix getApi error handling --- js/lib.main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/lib.main.js b/js/lib.main.js index c443cdf..6dc50bd 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -151,17 +151,17 @@ async function getApi(path,auth = false) { log(`resp.status: ${resp.status}`) log(`resp.json: ${json}`) if (resp.status != 200) { + log(`lib.main: getApi: Response status: ${resp.status}`) return resp.status } if (!resp.ok) { + log(`lib.main: getApi: Fetch error`) return false } - if (json === "[]") { - return 'empty' - } return json; } catch(err) { - return false + log(`lib.main: getApi: Caught fetch error. Status: ${resp.status}`) + return resp.status } }