Skip to content

Commit

Permalink
Merge pull request #110 from michael-james-holloway/add_errorf
Browse files Browse the repository at this point in the history
Add `status.Errorf` to the gRPC Wrappers
  • Loading branch information
knz committed Jun 5, 2023
2 parents 2662236 + d4f6f5e commit f6b9c79
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions grpc/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ func Error(c codes.Code, msg string) error {
return extgrpc.WrapWithGrpcCode(errors.New(msg), c)
}

func Errorf(c codes.Code, format string, args ...interface{}) error {
return extgrpc.WrapWithGrpcCode(errors.Newf(format, args...), c)
}

func WrapErr(c codes.Code, msg string, err error) error {
return extgrpc.WrapWithGrpcCode(errors.WrapWithDepth(1, err, msg), c)
}

func WrapErrf(c codes.Code, err error, format string, args ...interface{}) error {
return extgrpc.WrapWithGrpcCode(errors.WrapWithDepthf(1, err, format, args...), c)
}

func Code(err error) codes.Code {
return extgrpc.GetGrpcCode(err)
}

0 comments on commit f6b9c79

Please sign in to comment.