return codes.OK for nil error
This commit is contained in:
@ -208,6 +208,9 @@ func (e rpcError) Error() string {
|
|||||||
// Code returns the error code for err if it was produced by the rpc system.
|
// Code returns the error code for err if it was produced by the rpc system.
|
||||||
// Otherwise, it returns codes.Unknown.
|
// Otherwise, it returns codes.Unknown.
|
||||||
func Code(err error) codes.Code {
|
func Code(err error) codes.Code {
|
||||||
|
if err == nil {
|
||||||
|
return codes.OK
|
||||||
|
}
|
||||||
if e, ok := err.(rpcError); ok {
|
if e, ok := err.(rpcError); ok {
|
||||||
return e.code
|
return e.code
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user