mirror of
https://github.com/status-im/consul.git
synced 2025-01-22 03:29:43 +00:00
Better error logging
This commit is contained in:
parent
ead9c42abc
commit
37aa0ae7a5
@ -77,7 +77,7 @@ func (s *HTTPServer) wrap(handler func(resp http.ResponseWriter, req *http.Reque
|
||||
// Check for an error
|
||||
HAS_ERR:
|
||||
if err != nil {
|
||||
s.logger.Printf("[ERR] Request %v, error: %v", req, err)
|
||||
s.logger.Printf("[ERR] Request %v, error: %v", req.URL, err)
|
||||
resp.WriteHeader(500)
|
||||
resp.Write([]byte(err.Error()))
|
||||
return
|
||||
|
@ -1,6 +1,7 @@
|
||||
package consul
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/ugorji/go/codec"
|
||||
"net"
|
||||
"net/rpc"
|
||||
@ -161,7 +162,7 @@ func (p *ConnPool) RPC(addr net.Addr, method string, args interface{}, reply int
|
||||
// Try to get a conn first
|
||||
conn, err := p.Acquire(addr)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to get conn: %v", err)
|
||||
}
|
||||
|
||||
// Make the RPC call
|
||||
@ -179,7 +180,7 @@ func (p *ConnPool) RPC(addr net.Addr, method string, args interface{}, reply int
|
||||
} else {
|
||||
conn.Close()
|
||||
}
|
||||
return err
|
||||
return fmt.Errorf("rpc error: %v", err)
|
||||
}
|
||||
|
||||
// Reap is used to close conns open over maxTime
|
||||
|
Loading…
x
Reference in New Issue
Block a user