mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
error: write->writeTo
This commit is contained in:
parent
94e4595af5
commit
d0604c7d5c
@ -133,7 +133,7 @@ func (e Error) toJsonString() string {
|
|||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e Error) Write(w http.ResponseWriter) {
|
func (e Error) WriteTo(w http.ResponseWriter) {
|
||||||
w.Header().Add("X-Etcd-Index", fmt.Sprint(e.Index))
|
w.Header().Add("X-Etcd-Index", fmt.Sprint(e.Index))
|
||||||
// 3xx is raft internal error
|
// 3xx is raft internal error
|
||||||
status := http.StatusBadRequest
|
status := http.StatusBadRequest
|
||||||
|
@ -45,7 +45,7 @@ func writeError(w http.ResponseWriter, err error) {
|
|||||||
}
|
}
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
if e, ok := err.(*etcdErr.Error); ok {
|
if e, ok := err.(*etcdErr.Error); ok {
|
||||||
e.Write(w)
|
e.WriteTo(w)
|
||||||
} else {
|
} else {
|
||||||
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