From 32b7ebcfbc959497139c551747c07ee55783d978 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Sun, 11 Jun 2017 13:02:08 +0100 Subject: [PATCH] use updated error formatting --- broker/http_broker.go | 4 ++-- client/rpc_client.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/broker/http_broker.go b/broker/http_broker.go index 2ad8ed0a..98abac97 100644 --- a/broker/http_broker.go +++ b/broker/http_broker.go @@ -286,7 +286,7 @@ func (h *httpBroker) ServeHTTP(w http.ResponseWriter, req *http.Request) { b, err := ioutil.ReadAll(req.Body) if err != nil { - errr := errors.InternalServerError("go.micro.broker", fmt.Sprintf("Error reading request body: %v", err)) + errr := errors.InternalServerError("go.micro.broker", "Error reading request body: %v", err) w.WriteHeader(500) w.Write([]byte(errr.Error())) return @@ -294,7 +294,7 @@ func (h *httpBroker) ServeHTTP(w http.ResponseWriter, req *http.Request) { var m *Message if err = h.opts.Codec.Unmarshal(b, &m); err != nil { - errr := errors.InternalServerError("go.micro.broker", fmt.Sprintf("Error parsing request body: %v", err)) + errr := errors.InternalServerError("go.micro.broker", "Error parsing request body: %v", err) w.WriteHeader(500) w.Write([]byte(errr.Error())) return diff --git a/client/rpc_client.go b/client/rpc_client.go index cc4078bd..aa157bad 100644 --- a/client/rpc_client.go +++ b/client/rpc_client.go @@ -78,7 +78,7 @@ func (r *rpcClient) call(ctx context.Context, address string, req Request, resp var grr error c, err := r.pool.getConn(address, r.opts.Transport, transport.WithTimeout(opts.DialTimeout)) if err != nil { - return errors.InternalServerError("go.micro.client", fmt.Sprintf("connection error: %v", err)) + return errors.InternalServerError("go.micro.client", "connection error: %v", err) } defer func() { // defer execution of release @@ -98,7 +98,7 @@ func (r *rpcClient) call(ctx context.Context, address string, req Request, resp go func() { defer func() { if r := recover(); r != nil { - ch <- errors.InternalServerError("go.micro.client", fmt.Sprintf("panic recovered: %v", r)) + ch <- errors.InternalServerError("go.micro.client", "panic recovered: %v", r) } }() @@ -154,7 +154,7 @@ func (r *rpcClient) stream(ctx context.Context, address string, req Request, opt c, err := r.opts.Transport.Dial(address, transport.WithStream(), transport.WithTimeout(opts.DialTimeout)) if err != nil { - return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("connection error: %v", err)) + return nil, errors.InternalServerError("go.micro.client", "connection error: %v", err) } stream := &rpcStream{