diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2023-09-11 21:37:29 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2023-09-11 21:37:29 +0300 |
commit | b31ed4141f8fb0afccb8ae59bdd3614806f0e656 (patch) | |
tree | b6f5813b1a79c075d68b756b81aa5678ab62c67c | |
parent | 15fd83f36cd58bf2d8641d43e2d32276cfaf44ee (diff) | |
download | arching-kaos-web-ui-b31ed4141f8fb0afccb8ae59bdd3614806f0e656.tar.gz arching-kaos-web-ui-b31ed4141f8fb0afccb8ae59bdd3614806f0e656.tar.bz2 arching-kaos-web-ui-b31ed4141f8fb0afccb8ae59bdd3614806f0e656.zip |
Avoids running the callback function on 404
-rw-r--r-- | src/js/arching-kaos-fetch.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/js/arching-kaos-fetch.js b/src/js/arching-kaos-fetch.js index a22f9de..a29a5ae 100644 --- a/src/js/arching-kaos-fetch.js +++ b/src/js/arching-kaos-fetch.js @@ -18,7 +18,11 @@ function archingKaosFetchJSON( url, callback, params ){ const request = new XMLHttpRequest(); request.addEventListener("load", ()=>{ var json = JSON.parse(request.response); - callback(json, params); + if(request.status !== 404){ + callback(json, params); + } else { + archingKaosLog(`ERROR ${request.status} while loading ${url}`); + } }); request.addEventListener("error", ()=>{ console.log("An error occured."); |