mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 18:00:24 +08:00
dfb3cb510a
* Fix context error in rpc * Add a test case * Optimize judgment conditions * Add customized breaker errors for the client and server * Update method signature * Delete customized breaker errors * Delete the wrong test case
17 lines
329 B
Go
17 lines
329 B
Go
package codes
|
|
|
|
import (
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
// Acceptable checks if given error is acceptable.
|
|
func Acceptable(err error) bool {
|
|
switch status.Code(err) {
|
|
case codes.DeadlineExceeded, codes.Internal, codes.Unavailable, codes.DataLoss:
|
|
return false
|
|
default:
|
|
return true
|
|
}
|
|
}
|