use updated error formatting

This commit is contained in:
Asim Aslam 2017-06-11 13:02:08 +01:00
parent 097395c5cb
commit 32b7ebcfbc
2 changed files with 5 additions and 5 deletions

View File

@ -286,7 +286,7 @@ func (h *httpBroker) ServeHTTP(w http.ResponseWriter, req *http.Request) {
b, err := ioutil.ReadAll(req.Body) b, err := ioutil.ReadAll(req.Body)
if err != nil { 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.WriteHeader(500)
w.Write([]byte(errr.Error())) w.Write([]byte(errr.Error()))
return return
@ -294,7 +294,7 @@ func (h *httpBroker) ServeHTTP(w http.ResponseWriter, req *http.Request) {
var m *Message var m *Message
if err = h.opts.Codec.Unmarshal(b, &m); err != nil { 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.WriteHeader(500)
w.Write([]byte(errr.Error())) w.Write([]byte(errr.Error()))
return return

View File

@ -78,7 +78,7 @@ func (r *rpcClient) call(ctx context.Context, address string, req Request, resp
var grr error var grr error
c, err := r.pool.getConn(address, r.opts.Transport, transport.WithTimeout(opts.DialTimeout)) c, err := r.pool.getConn(address, r.opts.Transport, transport.WithTimeout(opts.DialTimeout))
if err != nil { 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 func() {
// defer execution of release // defer execution of release
@ -98,7 +98,7 @@ func (r *rpcClient) call(ctx context.Context, address string, req Request, resp
go func() { go func() {
defer func() { defer func() {
if r := recover(); r != nil { 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)) c, err := r.opts.Transport.Dial(address, transport.WithStream(), transport.WithTimeout(opts.DialTimeout))
if err != nil { 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{ stream := &rpcStream{