fix error handling
This commit is contained in:
parent
1b1dd543e0
commit
9e4445314f
3 changed files with 7 additions and 7 deletions
|
@ -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
|
||||||
|
|
8
main.go
8
main.go
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue