accept.go 278 B

123456789101112131415
  1. package codes
  2. import (
  3. "google.golang.org/grpc/codes"
  4. "google.golang.org/grpc/status"
  5. )
  6. func Acceptable(err error) bool {
  7. switch status.Code(err) {
  8. case codes.DeadlineExceeded, codes.Internal, codes.Unavailable, codes.DataLoss:
  9. return false
  10. default:
  11. return true
  12. }
  13. }