Merge pull request #992 from estesp/errrbody-likes-errrrors

Use error interfaces for content/metadata
This commit is contained in:
Michael Crosby
2017-06-21 11:55:11 -07:00
committed by GitHub
14 changed files with 254 additions and 70 deletions

View File

@@ -10,13 +10,12 @@ import (
func rewriteGRPCError(err error) error {
switch grpc.Code(errors.Cause(err)) {
case codes.AlreadyExists:
return content.ErrExists
return content.ErrExists(grpc.ErrorDesc(err))
case codes.NotFound:
return content.ErrNotFound
return content.ErrNotFound(grpc.ErrorDesc(err))
case codes.Unavailable:
return content.ErrLocked
return content.ErrLocked(grpc.ErrorDesc(err))
}
return err
}

View File

@@ -69,9 +69,9 @@ func rewriteGRPCError(err error) error {
switch grpc.Code(errors.Cause(err)) {
case codes.AlreadyExists:
return metadata.ErrExists
return metadata.ErrExists(grpc.ErrorDesc(err))
case codes.NotFound:
return metadata.ErrNotFound
return metadata.ErrNotFound(grpc.ErrorDesc(err))
}
return err

View File

@@ -27,9 +27,9 @@ func rewriteGRPCError(err error) error {
switch grpc.Code(errors.Cause(err)) {
case codes.AlreadyExists:
return metadata.ErrExists
return metadata.ErrExists(grpc.ErrorDesc(err))
case codes.NotFound:
return metadata.ErrNotFound
return metadata.ErrNotFound(grpc.ErrorDesc(err))
}
return err