Merge pull request #992 from estesp/errrbody-likes-errrrors
Use error interfaces for content/metadata
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user