Don't discard error message on sending response

Error messages are always discarded and it makes diagnostic difficult
when error occurs.

Before:
$ dnet network create -d overlay ov1
error : ""
$ docker network create -d overlay ov1
Error response from daemon: ""

After:
$ dnet network create -d overlay ov1
error : "no datastore configured. cannot obtain vxlan id"
$ docker network create -d overlay ov1
Error response from daemon: "no datastore configured. cannot obtain vxlan id"

Breakage caused by  7b8bb3e

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
This commit is contained in:
Toshiaki Makita
2015-09-02 16:12:19 -07:00
committed by Alessandro Boch
parent a125c33787
commit 8aa9f4eee6

View File

@@ -168,6 +168,10 @@ func makeHandler(ctrl libnetwork.NetworkController, fct processor) http.HandlerF
}
res, rsp := fct(ctrl, mux.Vars(req), body)
if !rsp.isOK() {
http.Error(w, rsp.Status, rsp.StatusCode)
return
}
if res != nil {
writeJSON(w, rsp.StatusCode, res)
}