Documentation
¶
Index ¶
- Variables
- func DumpErrorCodes() string
- func ErrStrResp(status int, b any, format string, a ...any) error
- func IsNotFound(err error) bool
- func Len() int
- func New(errno int, opts ...string) func(errs ...error) *ErrorCode
- type ErrorCode
- func (ec *ErrorCode) GetBadRequest() errcode_if.ErrorCodeIf
- func (ec *ErrorCode) GetCode() string
- func (ec *ErrorCode) GetErrno() int
- func (ec *ErrorCode) GetHttpStatus() int
- func (ec *ErrorCode) GetInternalError() errcode_if.ErrorCodeIf
- func (ec *ErrorCode) GetSuccess() errcode_if.ErrorCodeIf
- func (ec *ErrorCode) HttpCode() int
- func (ec *ErrorCode) NewRequestId() string
- func (ec *ErrorCode) ToCode(errno int) string
- func (ec *ErrorCode) ToHttpStatus(errno int) int
- func (ec *ErrorCode) ToHttpXJsonResponse() *httpx.JsonResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OK = newErrCode(http.StatusOK) InvalidErrorCode = &ErrorCode{httpx.JsonResponse{ Status: 0, Errno: constInvalidErrorBaseIndex, Code: "FatalErrorInvalidErrorCode", }} )
View Source
var ( ErrSuccess = New(http.StatusOK) ErrInsufficientStorage = New(http.StatusInsufficientStorage) ErrInternalServerError = New(http.StatusInternalServerError) ErrTimeout = New(http.StatusGatewayTimeout) ErrForbidden = New(http.StatusForbidden) ErrNotFound = New(http.StatusNotFound) ErrConflict = New(http.StatusConflict) ErrPreconditionFailed = New(http.StatusPreconditionFailed) ErrTooManyRequests = New(http.StatusTooManyRequests) ErrNotImplemented = New(http.StatusNotImplemented) ErrBadRequest = New(http.StatusBadRequest) ErrLengthRequired = New(http.StatusLengthRequired) ErrRequestURITooLong = New(http.StatusRequestURITooLong) ErrUnsupportedMediaType = New(http.StatusUnsupportedMediaType) ErrRequestedRangeNotSatisfiable = New(http.StatusRequestedRangeNotSatisfiable) ErrExpectationFailed = New(http.StatusExpectationFailed) ErrTeapot = New(http.StatusTeapot) ErrMisdirectedRequest = New(http.StatusMisdirectedRequest) ErrUnprocessableEntity = New(http.StatusUnprocessableEntity) ErrLocked = New(http.StatusLocked) ErrFailedDependency = New(http.StatusFailedDependency) ErrUpgradeRequired = New(http.StatusUpgradeRequired) ErrPreconditionRequired = New(http.StatusPreconditionRequired) ErrRequestHeaderFieldsTooLarge = New(http.StatusRequestHeaderFieldsTooLarge) ErrMultiStatus = New(http.StatusMultiStatus) ErrAlreadyReported = New(http.StatusAlreadyReported) ErrIMUsed = New(http.StatusIMUsed) ErrMultipleChoices = New(http.StatusMultipleChoices) ErrMovedPermanently = New(http.StatusMovedPermanently) ErrFound = New(http.StatusFound) ErrSeeOther = New(http.StatusSeeOther) ErrNotModified = New(http.StatusNotModified) ErrUseProxy = New(http.StatusUseProxy) ErrTemporaryRedirect = New(http.StatusTemporaryRedirect) ErrPermanentRedirect = New(http.StatusPermanentRedirect) ErrPaymentRequired = New(http.StatusPaymentRequired) ErrMethodNotAllowed = New(http.StatusMethodNotAllowed) ErrNotAcceptable = New(http.StatusNotAcceptable) ErrProxyAuthRequired = New(http.StatusProxyAuthRequired) ErrRequestTimeout = New(http.StatusRequestTimeout) ErrGone = New(http.StatusGone) ErrRequestEntityTooLarge = New(http.StatusRequestEntityTooLarge) ErrTooEarly = New(http.StatusTooEarly) ErrBadGateway = New(http.StatusBadGateway) ErrGatewayTimeout = New(http.StatusGatewayTimeout) ErrHTTPVersionNotSupported = New(http.StatusHTTPVersionNotSupported) ErrVariantAlsoNegotiates = New(http.StatusVariantAlsoNegotiates) ErrLoopDetected = New(http.StatusLoopDetected) ErrNotExtended = New(http.StatusNotExtended) ErrNetworkAuthenticationRequired = New(http.StatusNetworkAuthenticationRequired) )
View Source
var ( ErrWrongSign = New(http.StatusBadRequest, "WrongSign") ErrExpiredRequest = New(http.StatusBadRequest, "ExpiredRequest") ErrObjectExist = New(http.StatusBadRequest, "ObjectExist") ErrObjectNotExist = New(http.StatusBadRequest, "ObjectNotExist") ErrUserExist = New(http.StatusBadRequest, "UserExist") ErrUserNotExist = New(http.StatusBadRequest, "UserNotExist") ErrSessionNotExist = New(http.StatusBadRequest, "SessionNotExist") ErrSessionExist = New(http.StatusBadRequest, "SessionExist") ErrRTokenDisabled = New(http.StatusUnauthorized, "RTokenDisabled") ErrInvalidJwt = New(http.StatusUnauthorized, "InvalidJwt") ErrUnmatchedJwtKey = New(http.StatusUnauthorized, "UnmatchedJwtKey") ErrInvalidPassword = New(http.StatusUnauthorized, "InvalidPassword") ErrInvalidNonce = New(http.StatusUnauthorized, "InvalidNonce") ErrExpiredNonce = New(http.StatusUnauthorized, "ExpiredNonce") ErrInvalidSign = New(http.StatusUnauthorized, "InvalidSign") ErrExpiredToken = New(http.StatusUnauthorized, "ExpiredToken") ErrInvalidToken = New(http.StatusUnauthorized, "InvalidToken") ErrInvalidIssuer = New(http.StatusUnauthorized, "InvalidIssuer") ErrNotReady = New(http.StatusInternalServerError, "NotReady") ErrInvalidDataType = New(http.StatusInternalServerError, "InvalidDataType") )
Functions ¶
func DumpErrorCodes ¶ added in v1.3.75
func DumpErrorCodes() string
func ErrStrResp ¶ added in v1.3.75
func IsNotFound ¶ added in v1.3.75
Types ¶
type ErrorCode ¶ added in v1.3.75
type ErrorCode struct {
httpx.JsonResponse
}
func ErrHttpStatus ¶ added in v1.3.75
func (*ErrorCode) GetBadRequest ¶ added in v1.3.75
func (ec *ErrorCode) GetBadRequest() errcode_if.ErrorCodeIf
func (*ErrorCode) GetHttpStatus ¶ added in v1.3.75
func (*ErrorCode) GetInternalError ¶ added in v1.3.75
func (ec *ErrorCode) GetInternalError() errcode_if.ErrorCodeIf
func (*ErrorCode) GetSuccess ¶ added in v1.3.75
func (ec *ErrorCode) GetSuccess() errcode_if.ErrorCodeIf
func (*ErrorCode) HttpCode ¶ added in v1.3.75
HttpCode required by interface httpx.JsonResponseError
func (*ErrorCode) NewRequestId ¶ added in v1.3.75
func (*ErrorCode) ToHttpStatus ¶ added in v1.3.75
func (*ErrorCode) ToHttpXJsonResponse ¶ added in v1.3.75
func (ec *ErrorCode) ToHttpXJsonResponse() *httpx.JsonResponse
ConvertJsonResponse implement HttpxJsonResponseWrapper
Click to show internal directories.
Click to hide internal directories.