update
This commit is contained in:
19
mygrpc/error.go
Normal file
19
mygrpc/error.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package mygrpc
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
const (
|
||||
ServerTimeoutCode codes.Code = 10000
|
||||
ClientTimeoutCode codes.Code = 10001
|
||||
)
|
||||
|
||||
func GrpcClientTimeout(format string, args ...interface{}) error {
|
||||
return status.Newf(ClientTimeoutCode, format, args).Err()
|
||||
}
|
||||
|
||||
func GrpcServerTimeout(format string, args ...interface{}) error {
|
||||
return status.Newf(ServerTimeoutCode, format, args...).Err()
|
||||
}
|
||||
Reference in New Issue
Block a user