Improve error logging
This commit is contained in:
parent
02b9d9f54b
commit
7b4e16fd30
@ -437,18 +437,20 @@ func (m *FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
FI: nil,
|
FI: nil,
|
||||||
}, w, r)
|
}, w, r)
|
||||||
|
|
||||||
if code != 0 {
|
if code >= 400 {
|
||||||
w.WriteHeader(code)
|
w.WriteHeader(code)
|
||||||
|
|
||||||
if err != nil {
|
if err == nil {
|
||||||
log.Print(err)
|
|
||||||
w.Write([]byte(err.Error()))
|
|
||||||
} else {
|
|
||||||
txt := http.StatusText(code)
|
txt := http.StatusText(code)
|
||||||
log.Printf("%v: %v %v\n", r.URL.Path, code, txt)
|
log.Printf("%v: %v %v\n", r.URL.Path, code, txt)
|
||||||
w.Write([]byte(txt))
|
w.Write([]byte(txt))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Print(err)
|
||||||
|
w.Write([]byte(err.Error()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allowed checks if the user has permission to access a directory/file.
|
// Allowed checks if the user has permission to access a directory/file.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user