Documentation ¶
Index ¶
- func ConvertError(err error, msg string, defaultCode codes.Code) error
- func ConvertIndexError(err error, height uint64, defaultMsg string) error
- func ConvertMultiError(err *multierror.Error, msg string, defaultCode codes.Code) error
- func ConvertStorageError(err error) error
- func LoggingInterceptor(log zerolog.Logger) []grpc.UnaryServerInterceptor
- func NewRateLimiterInterceptor(log zerolog.Logger, apiRateLimits map[string]int, ...) *rateLimiterInterceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertError ¶ added in v0.30.0
ConvertError converts a generic error into a grpc status error. The input may either be a status.Error already, or standard error type. Any error that matches on of the common status code mappings will be converted, all unmatched errors will be converted to the provided defaultCode.
func ConvertIndexError ¶ added in v0.33.13
ConvertIndexError converts errors related to index and storage to appropriate gRPC status errors. If the error is nil, it returns nil. If the error is not recognized, it falls back to ConvertError with the provided default message and Internal gRPC code.
func ConvertMultiError ¶ added in v0.29.12
ConvertMultiError converts a multierror to a grpc status error. If the errors have related status codes, the common code is returned, otherwise defaultCode is used.
func ConvertStorageError ¶ added in v0.29.0
ConvertStorageError converts a generic error into a grpc status error, converting storage errors into codes.NotFound
func LoggingInterceptor ¶ added in v0.29.0
func LoggingInterceptor(log zerolog.Logger) []grpc.UnaryServerInterceptor
LoggingInterceptor creates the logging interceptors to log incoming GRPC request and response (minus the payload body)
func NewRateLimiterInterceptor ¶
func NewRateLimiterInterceptor(log zerolog.Logger, apiRateLimits map[string]int, apiBurstLimits map[string]int) *rateLimiterInterceptor
NewRateLimiterInterceptor creates a new rate limiter interceptor with the defined per second rate limits and the optional burst limit for each API.
Types ¶
This section is empty.