Documentation ¶
Index ¶
- func StreamServerInterceptor(handlers ...StreamServerErrorHandler) grpc.StreamServerInterceptor
- func UnaryServerInterceptor(handlers ...UnaryServerErrorHandler) grpc.UnaryServerInterceptor
- func WithCodeMap(m CodeMap) interface{ ... }
- func WithCodeMapper(mapFn CodeMapFunc) interface{ ... }
- func WithFailHandler(f FailHandlerFunc) interface{ ... }
- func WithGrpcStatusUnwrapper() interface{ ... }
- func WithNotWrappedErrorHandler(f ErrorHandlerFunc) interface{ ... }
- func WithReportableErrorHandler(f FailHandlerFunc) interface{ ... }
- type CodeMap
- type CodeMapFunc
- type ErrorHandlerFunc
- type FailHandlerFunc
- type StreamServerErrorHandler
- type StreamServerFailHandlerFunc
- type UnaryServerErrorHandler
- type UnaryServerFailHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamServerInterceptor ¶
func StreamServerInterceptor(handlers ...StreamServerErrorHandler) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor to handle errors
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(handlers ...UnaryServerErrorHandler) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor to handle errors
func WithCodeMap ¶ added in v1.0.0
func WithCodeMap(m CodeMap) interface { UnaryServerErrorHandler StreamServerErrorHandler }
WithCodeMap returns a new error handler function for mapping status codes to gRPC's one.
func WithCodeMapper ¶ added in v1.0.0
func WithCodeMapper(mapFn CodeMapFunc) interface { UnaryServerErrorHandler StreamServerErrorHandler }
WithCodeMapper returns a new error handler function for mapping status codes to gRPC's one with given function.
func WithFailHandler ¶ added in v1.0.0
func WithFailHandler(f FailHandlerFunc) interface { UnaryServerErrorHandler StreamServerErrorHandler }
WithFailHandler returns a new error handler function for handling errors wrapped with fail.Error.
func WithGrpcStatusUnwrapper ¶ added in v1.0.0
func WithGrpcStatusUnwrapper() interface { UnaryServerErrorHandler StreamServerErrorHandler }
WithGrpcStatusUnwrapper returns unwrapped error if this has a gRPC status.
func WithNotWrappedErrorHandler ¶
func WithNotWrappedErrorHandler(f ErrorHandlerFunc) interface { UnaryServerErrorHandler StreamServerErrorHandler }
WithNotWrappedErrorHandler returns a new error handler function for handling not wrapped errors.
func WithReportableErrorHandler ¶
func WithReportableErrorHandler(f FailHandlerFunc) interface { UnaryServerErrorHandler StreamServerErrorHandler }
WithReportableErrorHandler returns a new error handler function for handling errors annotated with the reportability.
Types ¶
type CodeMapFunc ¶ added in v1.0.0
CodeMapFunc returns gRPC's `codes.Code`s from given any codes.
type ErrorHandlerFunc ¶
ErrorHandlerFunc is a function that called by interceptors when specified erorrs are detected.
type FailHandlerFunc ¶ added in v1.0.0
FailHandlerFunc is a function that called by interceptors when specified application erorrs are detected.
type StreamServerErrorHandler ¶ added in v1.0.0
type StreamServerErrorHandler interface {
HandleStreamServerError(context.Context, interface{}, interface{}, *grpc.StreamServerInfo, error) error
}
StreamServerErrorHandler is the interface that can handle errors on a gRPC stream server
func WithStreamServerFailHandler ¶ added in v1.0.0
func WithStreamServerFailHandler(f StreamServerFailHandlerFunc) StreamServerErrorHandler
WithStreamServerFailHandler returns a new error handler for stream servers for handling errors wrapped with fail.Error.
func WithStreamServerReportableErrorHandler ¶ added in v1.0.0
func WithStreamServerReportableErrorHandler(f StreamServerFailHandlerFunc) StreamServerErrorHandler
WithStreamServerReportableErrorHandler returns a new error handler for stream servers for handling errors annotated with the reportability.
type StreamServerFailHandlerFunc ¶ added in v1.0.0
type StreamServerFailHandlerFunc func(context.Context, interface{}, interface{}, *grpc.StreamServerInfo, *fail.Error) error
StreamServerFailHandlerFunc is a function that called by stream server interceptors when specified application erorrs are detected.
type UnaryServerErrorHandler ¶ added in v1.0.0
type UnaryServerErrorHandler interface {
HandleUnaryServerError(context.Context, interface{}, *grpc.UnaryServerInfo, error) error
}
UnaryServerErrorHandler is the interface that can handle errors on a gRPC unary server
func WithUnaryServerFailHandler ¶ added in v1.0.0
func WithUnaryServerFailHandler(f UnaryServerFailHandlerFunc) UnaryServerErrorHandler
WithUnaryServerFailHandler returns a new error handler for unary servers for handling errors wrapped with fail.Error.
func WithUnaryServerReportableErrorHandler ¶ added in v1.0.0
func WithUnaryServerReportableErrorHandler(f UnaryServerFailHandlerFunc) UnaryServerErrorHandler
WithUnaryServerReportableErrorHandler returns a new error handler for unary servers for handling errors annotated with the reportability.
type UnaryServerFailHandlerFunc ¶ added in v1.0.0
type UnaryServerFailHandlerFunc func(context.Context, interface{}, *grpc.UnaryServerInfo, *fail.Error) error
UnaryServerFailHandlerFunc is a function that called by unary server interceptors when specified application erorrs are detected.