aboutsummaryrefslogtreecommitdiff
path: root/src/js/arching-kaos-fetch.js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-09-11 21:37:29 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-09-11 21:37:29 +0300
commitb31ed4141f8fb0afccb8ae59bdd3614806f0e656 (patch)
treeb6f5813b1a79c075d68b756b81aa5678ab62c67c /src/js/arching-kaos-fetch.js
parent15fd83f36cd58bf2d8641d43e2d32276cfaf44ee (diff)
downloadarching-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
Diffstat (limited to 'src/js/arching-kaos-fetch.js')
-rw-r--r--src/js/arching-kaos-fetch.js6
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.");