Skip to content

Commit f6b9c79

Browse files
authored
Merge pull request #110 from michael-james-holloway/add_errorf
Add `status.Errorf` to the gRPC Wrappers
2 parents 2662236 + d4f6f5e commit f6b9c79

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

grpc/status/status.go

+8
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ func Error(c codes.Code, msg string) error {
1111
return extgrpc.WrapWithGrpcCode(errors.New(msg), c)
1212
}
1313

14+
func Errorf(c codes.Code, format string, args ...interface{}) error {
15+
return extgrpc.WrapWithGrpcCode(errors.Newf(format, args...), c)
16+
}
17+
1418
func WrapErr(c codes.Code, msg string, err error) error {
1519
return extgrpc.WrapWithGrpcCode(errors.WrapWithDepth(1, err, msg), c)
1620
}
1721

22+
func WrapErrf(c codes.Code, err error, format string, args ...interface{}) error {
23+
return extgrpc.WrapWithGrpcCode(errors.WrapWithDepthf(1, err, format, args...), c)
24+
}
25+
1826
func Code(err error) codes.Code {
1927
return extgrpc.GetGrpcCode(err)
2028
}

0 commit comments

Comments
 (0)