Skip to content

Commit

Permalink
Log: debug user cancellation and log warning for rest
Browse files Browse the repository at this point in the history
The context error with cancel code is typically for user cancellation which
should be at debug level. For other error codes we should display a warning.

Fixes etcd-io#9085
  • Loading branch information
spzala committed Jan 8, 2018
1 parent 4b50c66 commit 481832e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion etcdserver/api/v3rpc/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ func isClientCtxErr(ctxErr error, err error) bool {
if ctxErr != nil {
return ctxErr == context.Canceled || ctxErr == context.DeadlineExceeded
}
ev, _ := status.FromError(err)

ev, ok := status.FromError(err)
if !ok {
return false
}
code := ev.Code()
return code == codes.Canceled || code == codes.DeadlineExceeded
}

0 comments on commit 481832e

Please sign in to comment.