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:
hdd:
max_percent: 100
max_percent: 10
load:
max_load_1: 10
max_load_5: 8

View file

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

View file

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