Documentation ¶
Index ¶
- Constants
- func GetErrCode(err error) int32
- func GetErrorMsgWithCode(code int32) string
- func RegisterError(errs ...*Error)
- func RegisterErrorWithYaml(buf []byte)
- type Error
- func ErrInvalid(a ...interface{}) *Error
- func ErrOptionConflict(a ...interface{}) *Error
- func ErrRetry(format string, a ...interface{}) *Error
- func ErrThirdParty(format string, a ...interface{}) *Error
- func NewError[M int | int32](code M) *Error
- func NewErrorWithError(err error) *Error
- func NewErrorWithMsg[M int | int32](code M, format string, a ...interface{}) *Error
- func (p *Error) Clone() *Error
- func (p *Error) Error() string
- func (p *Error) Is(err error) bool
- func (p *Error) NeedRetry() bool
- func (p *Error) SetErrCode(code int32) *Error
- func (p *Error) SetRetry(b ...bool) *Error
- func (p *Error) SetRetryDelay(delay time.Duration) *Error
- func (p *Error) SetSkipRetryCount(b ...bool) *Error
Constants ¶
View Source
const ( SysError = -1 Success = 0 // 100-999 http状态码 StatusContinue = 100 StatusSwitchingProtocols = 101 StatusProcessing = 102 StatusEarlyHints = 103 StatusCreated = 201 StatusAccepted = 202 StatusNonAuthoritativeInfo = 203 StatusNoContent = 204 StatusResetContent = 205 StatusPartialContent = 206 StatusMultiStatus = 207 StatusAlreadyReported = 208 StatusIMUsed = 226 StatusMultipleChoices = 300 StatusMovedPermanently = 301 StatusFound = 302 StatusSeeOther = 303 StatusNotModified = 304 StatusUseProxy = 305 StatusTemporaryRedirect = 307 StatusPermanentRedirect = 308 StatusBadRequest = 400 StatusPaymentRequired = 402 StatusForbidden = 403 StatusNotFound = 404 StatusMethodNotAllowed = 405 StatusNotAcceptable = 406 StatusProxyAuthRequired = 407 StatusRequestTimeout = 408 StatusConflict = 409 StatusGone = 410 StatusLengthRequired = 411 StatusPreconditionFailed = 412 StatusRequestEntityTooLarge = 413 StatusRequestURITooLong = 414 StatusUnsupportedMediaType = 415 StatusRequestedRangeNotSatisfiable = 416 StatusExpectationFailed = 417 StatusTeapot = 418 StatusMisdirectedRequest = 421 StatusUnprocessableEntity = 422 StatusLocked = 423 StatusFailedDependency = 424 StatusTooEarly = 425 StatusUpgradeRequired = 426 StatusPreconditionRequired = 428 StatusTooManyRequests = 429 StatusRequestHeaderFieldsTooLarge = 431 StatusInternalServerError = 500 StatusNotImplemented = 501 StatusBadGateway = 502 StatusGatewayTimeout = 504 StatusHTTPVersionNotSupported = 505 StatusVariantAlsoNegotiates = 506 StatusInsufficientStorage = 507 StatusLoopDetected = 508 StatusNotExtended = 510 StatusNetworkAuthenticationRequired = 511 // 系统错误 InvalidError = 1001 QueueFull = 1002 TokenNotFound = 1003 OptionConflict = 1004 ThirdPartyError = 1005 RetryError = 1006 InvalidToken = 1007 )
Variables ¶
This section is empty.
Functions ¶
func GetErrCode ¶
func GetErrorMsgWithCode ¶
func RegisterError ¶
func RegisterError(errs ...*Error)
func RegisterErrorWithYaml ¶
func RegisterErrorWithYaml(buf []byte)
Types ¶
type Error ¶
type Error struct { Code int32 `json:"code,omitempty" yaml:"code,omitempty"` Msg string `json:"msg,omitempty" yaml:"msg,omitempty"` SkipRetryCount bool `json:"skip_retry_count,omitempty" yaml:"skip_retry_count,omitempty"` Retry bool `json:"retry,omitempty" yaml:"retry,omitempty"` RetryDelay time.Duration `json:"retry_delay,omitempty" yaml:"retry_delay,omitempty"` }
func ErrInvalid ¶
func ErrInvalid(a ...interface{}) *Error
func ErrOptionConflict ¶
func ErrOptionConflict(a ...interface{}) *Error
func ErrThirdParty ¶
func NewErrorWithError ¶
func NewErrorWithMsg ¶
func (*Error) SetErrCode ¶
func (*Error) SetSkipRetryCount ¶
Click to show internal directories.
Click to hide internal directories.