Skip to content

Commit

Permalink
errdefs: use status package for mapping errors
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen J Day <[email protected]>
  • Loading branch information
stevvooe committed Oct 10, 2017
1 parent d8bd6b7 commit fe52d93
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions errdefs/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ func ToGRPC(err error) error {

switch {
case IsInvalidArgument(err):
return grpc.Errorf(codes.InvalidArgument, err.Error())
return status.Errorf(codes.InvalidArgument, err.Error())
case IsNotFound(err):
return grpc.Errorf(codes.NotFound, err.Error())
return status.Errorf(codes.NotFound, err.Error())
case IsAlreadyExists(err):
return grpc.Errorf(codes.AlreadyExists, err.Error())
return status.Errorf(codes.AlreadyExists, err.Error())
case IsFailedPrecondition(err):
return grpc.Errorf(codes.FailedPrecondition, err.Error())
return status.Errorf(codes.FailedPrecondition, err.Error())
case IsUnavailable(err):
return grpc.Errorf(codes.Unavailable, err.Error())
return status.Errorf(codes.Unavailable, err.Error())
case IsNotImplemented(err):
return grpc.Errorf(codes.Unimplemented, err.Error())
return status.Errorf(codes.Unimplemented, err.Error())
}

return err
Expand Down

0 comments on commit fe52d93

Please sign in to comment.