fix error handling

This commit is contained in:
Kekskurse 2021-09-20 23:52:07 +02:00
parent 1b1dd543e0
commit 9e4445314f
Signed by: kekskurse
GPG key ID: 728ACCB59341E7E4
3 changed files with 7 additions and 7 deletions

View file

@ -3,7 +3,7 @@ http:
checks: checks:
hdd: hdd:
max_percent: 100 max_percent: 10
load: load:
max_load_1: 10 max_load_1: 10
max_load_5: 8 max_load_5: 8

View file

@ -24,12 +24,10 @@ func main() {
http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) { http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) {
_, gloableRes := checkSystem() _, gloableRes := checkSystem()
if gloableRes { if gloableRes == false {
writer.Write([]byte(s)) writer.WriteHeader(http.StatusInternalServerError)
} else {
http.Error(writer, s, http.StatusInternalServerError)
} }
writer.Write([]byte("Fatal Error")) writer.Write([]byte(s))
}) })
http.HandleFunc("/data.json", handler) http.HandleFunc("/data.json", handler)
err := http.ListenAndServe(c.HTTP.Listen, nil) err := http.ListenAndServe(c.HTTP.Listen, nil)

View file

@ -51,8 +51,10 @@
console.log("ajax done") console.log("ajax done")
handleData(data) handleData(data)
}).always(function(data) { }).always(function(data) {
console.log("always")
if(data.responseText != "") { if(data.responseText != "") {
handleData(data) console.log(data.responseText)
handleData(data.responseText)
} }
setTimeout("getData();", 10000); setTimeout("getData();", 10000);