Change status package to deal with concrete types instead of interfaces (#1171)

This commit is contained in:
dfawley
2017-04-06 11:41:07 -07:00
committed by GitHub
parent b507112439
commit 1d27587e10
12 changed files with 82 additions and 102 deletions

View File

@ -404,9 +404,10 @@ func Errorf(c codes.Code, format string, a ...interface{}) error {
// toRPCErr converts an error into an error from the status package.
func toRPCErr(err error) error {
switch e := err.(type) {
case status.Status:
if _, ok := status.FromError(err); ok {
return err
}
switch e := err.(type) {
case transport.StreamError:
return status.Error(e.Code, e.Desc)
case transport.ConnectionError: