Added error message for generic errors

This commit is contained in:
Nicolai Ort 2021-08-17 19:43:39 +02:00
parent 71a6795fce
commit 4fb608a955
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
1 changed files with 8 additions and 3 deletions

11
main.js
View File

@ -55,7 +55,7 @@ function createUrl() {
}
document.getElementById("error_dismiss").onclick = () =>{
document.getElementById("error_dismiss").onclick = () => {
document.getElementById("error_container").classList.add("hidden");
};
/**
@ -64,11 +64,16 @@ document.getElementById("error_dismiss").onclick = () =>{
*/
function handleError(res) {
if (res.status == 400) {
res.text().then((body)=>{
document.getElementById("error_text").innerText=body;
res.text().then((body) => {
document.getElementById("error_text").innerText = body;
document.getElementById("error_container").classList.remove("hidden");
})
}
else {
console.log(res);
document.getElementById("error_text").innerText = "An unknown error occured (see console for more details)";
document.getElementById("error_container").classList.remove("hidden");
}
}
//Resets the UI