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 c2185e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions etcdserver/api/v3rpc/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ func togRPCError(err error) error {

func isClientCtxErr(ctxErr error, err error) bool {
if ctxErr != nil {
return ctxErr == context.Canceled || ctxErr == context.DeadlineExceeded
return true
}

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

0 comments on commit c2185e1

Please sign in to comment.