go-zero/zrpc/internal/codes/accept.go

16 lines
278 B
Go
Raw Normal View History

2020-08-06 20:55:38 +08:00
package codes
import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func Acceptable(err error) bool {
switch status.Code(err) {
case codes.DeadlineExceeded, codes.Internal, codes.Unavailable, codes.DataLoss:
return false
default:
return true
}
}