mirror of
https://github.com/status-im/consul.git
synced 2025-01-22 11:40:06 +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
|
// Check for an error
|
||||||
HAS_ERR:
|
HAS_ERR:
|
||||||
if err != nil {
|
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.WriteHeader(500)
|
||||||
resp.Write([]byte(err.Error()))
|
resp.Write([]byte(err.Error()))
|
||||||
return
|
return
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package consul
|
package consul
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/ugorji/go/codec"
|
"github.com/ugorji/go/codec"
|
||||||
"net"
|
"net"
|
||||||
"net/rpc"
|
"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
|
// Try to get a conn first
|
||||||
conn, err := p.Acquire(addr)
|
conn, err := p.Acquire(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to get conn: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the RPC call
|
// Make the RPC call
|
||||||
@ -179,7 +180,7 @@ func (p *ConnPool) RPC(addr net.Addr, method string, args interface{}, reply int
|
|||||||
} else {
|
} else {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}
|
}
|
||||||
return err
|
return fmt.Errorf("rpc error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reap is used to close conns open over maxTime
|
// Reap is used to close conns open over maxTime
|
||||||
|
Loading…
x
Reference in New Issue
Block a user