Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterErrorCodes ¶ added in v0.2.18
RegisterErrorCodes set custom error codes for DefaultHTTPError for exp: server.RegisterErrorCodes(pb.ErrorCode_name) SetCustomErrorCodes set custom error codes for DefaultHTTPError the map[int32]string is compact to protobuf's ENMU_name 2*** HTTP status 200 4*** HTTP status 400 5*** AND other HTTP status 500 For exp: in proto
enum CommonError { captcha_required = 4001; invalid_captcha = 4002; }
in code server.RegisterErrorCodes(common.CommonError_name)
Types ¶
type CatchHandler ¶
type CatchHandler interface { Catch(e error, handler func(err error)) CatchHandler CatchAll(handler func(err error)) FinalHandler FinalHandler }
func Try ¶
func Try(f func()) CatchHandler
type FinalHandler ¶
type FinalHandler interface {
Finally(handlers ...func())
}
Click to show internal directories.
Click to hide internal directories.