Merge pull request #166 from iamqizhao/hpack

return codes.OK for nil error
This commit is contained in:
Qi Zhao
2015-04-15 13:15:24 -07:00

View File

@ -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
}