Documentation
¶
Overview ¶
Package fmterr is a set of tools for error.
Index ¶
- Variables
- func InitErrorHandler(cfg *conf.Configuration) error
- func ParseCodeMap(cfg *conf.Configuration) error
- func UnaryClientInterceptorInGin(_ *conf.Configuration) grpc.UnaryClientInterceptor
- func UnaryServerInterceptor(cfg *conf.Configuration) grpc.UnaryServerInterceptor
- func WrapperGrpcStatus(err error) error
- type Error
Constants ¶
This section is empty.
Variables ¶
View Source
var UnknownError = errors.New("unknown error")
Functions ¶
func InitErrorHandler ¶
func InitErrorHandler(cfg *conf.Configuration) error
InitErrorHandler pass to the error handler component
func ParseCodeMap ¶
func ParseCodeMap(cfg *conf.Configuration) error
ParseCodeMap parse error code map from configuration. The configuration format is {int key} : {string}, for example:
1000: "error text"
func UnaryClientInterceptorInGin ¶
func UnaryClientInterceptorInGin(_ *conf.Configuration) grpc.UnaryClientInterceptor
UnaryClientInterceptorInGin error handler for grpc client side in Gin. It will try to convert grpc status to gin.Error.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(cfg *conf.Configuration) grpc.UnaryServerInterceptor
UnaryServerInterceptor error handler for grpc server side
func WrapperGrpcStatus ¶
WrapperGrpcStatus wrap grpc error to pass to client.
Types ¶
type Error ¶
Error is a wrapper for gin.Error
func Codef ¶
Codef create a new error by code and args. args is a list of key value pairs, key is string, value is any. length of kvs equals 1 is meaning the error message.
Click to show internal directories.
Click to hide internal directories.