Skip to content

Commit

Permalink
use updated error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Asim Aslam committed Jun 11, 2017
1 parent 097395c commit 32b7ebc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions broker/http_broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,15 @@ 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
}

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
Expand Down
6 changes: 3 additions & 3 deletions client/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}()

Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 32b7ebc

Please sign in to comment.