mirror of
https://github.com/sourcegraph/jsonrpc2.git
synced 2026-06-16 04:04:56 +02:00
minor logging fixes
Signed-off-by: s3rj1k <evasive.gyron@gmail.com>
This commit is contained in:
parent
3bf62ad25c
commit
81af42d766
3 changed files with 4 additions and 4 deletions
|
|
@ -43,7 +43,7 @@ func LogMessages(logger Logger) ConnOpt {
|
|||
|
||||
OnRecv(func(req *Request, resp *Response) {
|
||||
switch {
|
||||
case req != nil && resp == nil:
|
||||
case req != nil:
|
||||
mu.Lock()
|
||||
reqMethods[req.ID] = req.Method
|
||||
mu.Unlock()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ func (h *HandlerWithErrorConfigurer) Handle(ctx context.Context, conn *Conn, req
|
|||
result, err := h.handleFunc(ctx, conn, req)
|
||||
if req.Notif {
|
||||
if err != nil {
|
||||
conn.logger.Printf("jsonrpc2 handler: notification %q handling error: %s\n", req.Method, err)
|
||||
conn.logger.Printf("jsonrpc2 handler: notification %q handling error: %v\n", req.Method, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ func (h *HandlerWithErrorConfigurer) Handle(ctx context.Context, conn *Conn, req
|
|||
if !req.Notif {
|
||||
if err := conn.SendResponse(ctx, resp); err != nil {
|
||||
if err != ErrClosed || !h.suppressErrClosed {
|
||||
conn.logger.Printf("jsonrpc2 handler: sending response %s: %s\n", resp.ID, err)
|
||||
conn.logger.Printf("jsonrpc2 handler: sending response %s: %v\n", resp.ID, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func TestAnyMessage(t *testing.T) {
|
|||
var m anyMessage
|
||||
if err := json.Unmarshal([]byte(s), &m); err != nil {
|
||||
if !want.invalid {
|
||||
t.Errorf("%s: error: %s", s, err)
|
||||
t.Errorf("%s: error: %v", s, err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue