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,
|
||||
}, w, r)
|
||||
|
||||
if code != 0 {
|
||||
if code >= 400 {
|
||||
w.WriteHeader(code)
|
||||
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
w.Write([]byte(err.Error()))
|
||||
} else {
|
||||
if err == nil {
|
||||
txt := http.StatusText(code)
|
||||
log.Printf("%v: %v %v\n", r.URL.Path, code, 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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user