mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #1463 from bcwaldon/writeError-logging
etcdhttp: only log when error deserves it
This commit is contained in:
commit
57d447fef6
@ -44,13 +44,13 @@ func writeError(w http.ResponseWriter, err error) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println(err)
|
|
||||||
switch e := err.(type) {
|
switch e := err.(type) {
|
||||||
case *etcdErr.Error:
|
case *etcdErr.Error:
|
||||||
e.WriteTo(w)
|
e.WriteTo(w)
|
||||||
case *httptypes.HTTPError:
|
case *httptypes.HTTPError:
|
||||||
e.WriteTo(w)
|
e.WriteTo(w)
|
||||||
default:
|
default:
|
||||||
|
log.Printf("etcdhttp: unexpected error: %v", err)
|
||||||
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user