Documentation
¶
Index ¶
- func IsGrpcError(err error, code codes.Code) bool
- func IsGrpcNotFoundError(err error) bool
- func IsServerError(err error) bool
- type LogicError
- func New400LogicError(lang string, messageID string, tplData ...any) *LogicError
- func New401LogicError(lang string, messageID string, tplData ...any) *LogicError
- func New403LogicError(lang string, messageID string, tplData ...any) *LogicError
- func New404LogicError(lang string, messageID string, tplData ...any) *LogicError
- func New500LogicError(lang string, messageID string, tplData ...any) *LogicError
- func NewLogicErr(code int16, lang string, messageID string, tplData ...any) *LogicError
- func NewRawLogicErr(code int16, message string) *LogicError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGrpcError ¶ added in v0.7.0
IsGrpcError 判断是否是grpc中的指定类型错误
func IsGrpcNotFoundError ¶ added in v0.6.0
IsGrpcNotFoundError 判断是否是grpc中的codes.NotFound类型的错误
Types ¶
type LogicError ¶
type LogicError struct {
// contains filtered or unexported fields
}
LogicError 业务逻辑错误
func New400LogicError ¶
func New400LogicError(lang string, messageID string, tplData ...any) *LogicError
New400LogicError 返回400错误(非法参数)
func New401LogicError ¶
func New401LogicError(lang string, messageID string, tplData ...any) *LogicError
New401LogicError 返回401错误(未认证)
func New403LogicError ¶
func New403LogicError(lang string, messageID string, tplData ...any) *LogicError
New403LogicError 返回403错误(未授权)
func New404LogicError ¶
func New404LogicError(lang string, messageID string, tplData ...any) *LogicError
New404LogicError 返回404错误(资源不存在)
func New500LogicError ¶
func New500LogicError(lang string, messageID string, tplData ...any) *LogicError
New500LogicError 返回500错误(服务器内部错误)
func NewLogicErr ¶
func NewLogicErr(code int16, lang string, messageID string, tplData ...any) *LogicError
NewLogicErr 返回指定编码的业务逻辑错误
func NewRawLogicErr ¶
func NewRawLogicErr(code int16, message string) *LogicError
NewRawLogicErr 返回指定编码的业务逻辑错误
Click to show internal directories.
Click to hide internal directories.