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:
|
||||
hdd:
|
||||
max_percent: 100
|
||||
max_percent: 10
|
||||
load:
|
||||
max_load_1: 10
|
||||
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) {
|
||||
_, 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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue