Skip to content

Commit d4f6f5e

Browse files
committedJun 5, 2023
Add WrapErrf
1 parent a58d7dc commit d4f6f5e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎grpc/status/status.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ func Error(c codes.Code, msg string) error {
1212
}
1313

1414
func Errorf(c codes.Code, format string, args ...interface{}) error {
15-
return extgrpc.WrapWithGrpcCode(errors.Errorf(format, args...), c)
15+
return extgrpc.WrapWithGrpcCode(errors.Newf(format, args...), c)
1616
}
1717

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

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+
2226
func Code(err error) codes.Code {
2327
return extgrpc.GetGrpcCode(err)
2428
}

0 commit comments

Comments
 (0)
Please sign in to comment.