Documentation
¶
Index ¶
- Constants
- type AError
- type CodeType
- type Coder
- type Error
- type Field
- type Fields
- type HTTPStatus
- type Message
- type Option
- func WithCode(code CodeType) Option
- func WithCustom(code CodeType, msg string) Option
- func WithErr(err error) Option
- func WithFields(fields ...Field) Option
- func WithHTTPStatus(httpCode int) Option
- func WithMessage(message string) Option
- func WithStack(stack []byte) Option
- func WithStringer(str fmt.Stringer) Option
- type Stacker
Constants ¶
View Source
const ( ErrMessageUnknown = "未知错误" ErrMessageInvalidParam = "参数错误" ErrMessageInvalidToken = "token错误" ErrMessageInvalidSign = "签名错误" ErrMessageInvalidRequest = "请求错误" ErrMessageInvalidResponse = "响应错误" ErrMessageInvalidData = "数据错误" ErrMessageInvalidState = "状态错误" ErrMessageInvalidOperation = "操作错误" ErrMessageInvalidPermission = "权限错误" ErrMessageInvalidUser = "用户错误" ErrMessageInvalidSystem = "系统错误" ErrMessageInvalidService = "服务错误" ErrMessageInvalidNetwork = "网络错误" ErrMessageInvalidDatabase = "数据库错误" ErrMessageInvalidCache = "缓存错误" ErrMessageCacheExpired = "缓存过期" ErrMessageInvalidThirdParty = "第三方错误" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AError ¶
type AError struct {
// contains filtered or unexported fields
}
func (*AError) HTTPStatus ¶
type CodeType ¶
type CodeType int
const ( ErrCodeUnknown CodeType = 10000 + iota // 未知错误码 ErrCodeInvalidParam // 参数错误 ErrCodeInvalidToken // token错误 ErrCodeInvalidSign // 签名错误 ErrCodeInvalidRequest // 请求错误 ErrCodeInvalidResponse // 响应错误 ErrCodeInvalidData // 数据错误 ErrCodeInvalidState // 状态错误 ErrCodeInvalidOperation // 操作错误 ErrCodeInvalidPermission // 权限错误 ErrCodeInvalidUser // 用户错误 ErrCodeInvalidSystem // 系统错误 ErrCodeInvalidService // 服务错误 ErrCodeInvalidNetwork // 网络错误 ErrCodeInvalidDatabase // 数据库错误 ErrCodeInvalidCache // 缓存错误 ErrCodeCacheExpired // 缓存过期 ErrCodeInvalidThirdParty // 第三方错误 )
type HTTPStatus ¶
type HTTPStatus interface {
HTTPStatus() int
}
type Option ¶
type Option func(*AError)
func WithCustom ¶ added in v1.2.0
func WithFields ¶
func WithHTTPStatus ¶
func WithMessage ¶
func WithStringer ¶ added in v1.2.0
Click to show internal directories.
Click to hide internal directories.