From 481832e591e9399f6762c71d55d5780394f53cde Mon Sep 17 00:00:00 2001 From: "Sahdev P. Zala" Date: Sun, 7 Jan 2018 21:21:21 -0500 Subject: [PATCH] Log: debug user cancellation and log warning for rest 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 #9085 --- etcdserver/api/v3rpc/util.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etcdserver/api/v3rpc/util.go b/etcdserver/api/v3rpc/util.go index ec34249c1eb5..434840ef10ae 100644 --- a/etcdserver/api/v3rpc/util.go +++ b/etcdserver/api/v3rpc/util.go @@ -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 }