From 6682b35fb6811af9d387603927abd47389fb786e Mon Sep 17 00:00:00 2001 From: iamqizhao Date: Wed, 15 Apr 2015 11:41:42 -0700 Subject: [PATCH] return codes.OK for nil error --- rpc_util.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rpc_util.go b/rpc_util.go index 623b85b1..49512603 100644 --- a/rpc_util.go +++ b/rpc_util.go @@ -208,6 +208,9 @@ func (e rpcError) Error() string { // Code returns the error code for err if it was produced by the rpc system. // Otherwise, it returns codes.Unknown. func Code(err error) codes.Code { + if err == nil { + return codes.OK + } if e, ok := err.(rpcError); ok { return e.code }