errcode

package
v1.3.88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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)
	ErrUnauthorized        = New(http.StatusUnauthorized)
	ErrPreconditionFailed  = New(http.StatusPreconditionFailed)
	ErrTooManyRequests     = New(http.StatusTooManyRequests)
	ErrNotImplemented      = New(http.StatusNotImplemented)
	ErrBadRequest          = New(http.StatusBadRequest)

	ErrIdempotent = New(http.StatusAccepted, "AlreadyAccepted")

	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)
	ErrUnavailableForLegalReasons   = New(http.StatusUnavailableForLegalReasons)
	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)
	ErrServiceUnavailable            = New(http.StatusServiceUnavailable)
	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 (
	ErrIdempotentError   = New(http.StatusAccepted, "AlreadyAccepted")
	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")
	ErrUnsupportedDevice = New(http.StatusBadRequest, "UnsupportedDevice")
	ErrInvalidDeviceId   = New(http.StatusBadRequest, "InvalidDeviceId")

	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")

	ErrDeviceCommunicateErr = New(http.StatusInternalServerError, "DeviceCommunicateErr")
	ErrNotReady             = New(http.StatusInternalServerError, "NotReady")
	ErrInvalidDataType      = New(http.StatusInternalServerError, "InvalidDataType")

	ErrDeviceOffline  = New(http.StatusBadRequest, "DeviceOffline")
	ErrInUpgrading    = New(http.StatusBadRequest, "InUpgrading")
	ErrUpgradeTimeout = New(http.StatusInternalServerError, "UpgradeTimeout")

	ErrOnethingTooBusy = New(http.StatusTooManyRequests, "OnethingTooBusy")
	ErrObjectBusy      = New(http.StatusTooManyRequests, "ObjectBusy")

	ErrInvalidVrfCode = New(http.StatusBadRequest, "InvalidSmsCode")
	ErrExpiredVrfCode = New(http.StatusBadRequest, "ExpiredSmsCode")

	ErrWrongWxNode = New(http.StatusBadRequest, "WrongWxNode")

	ErrOmDevicePppoe                  = New(http.StatusInternalServerError, "OmDevicePppoe")
	ErrOmDeviceOffline                = New(http.StatusInternalServerError, "OmDeviceOffline")
	ErrOmDeviceEmptyResponse          = New(http.StatusInternalServerError, "OmDeviceEmptyResponse")
	ErrOmResponseError                = New(http.StatusInternalServerError, "OmResponseError")
	ErrOnethingAlreadyBound           = New(http.StatusInternalServerError, "OnethingAlreadyBound")
	ErrOnethingBadRequest             = New(http.StatusInternalServerError, "OnethingBadRequest")
	ErrOnethingNoDevice               = New(http.StatusInternalServerError, "OnethingNoDevice")
	ErrOnethingNotBound               = New(http.StatusInternalServerError, "OnethingNotBound")
	ErrOnethingWrongActCodeOrUnAct    = New(http.StatusInternalServerError, "OnethingWrongActCodeOrUnAct")
	ErrOnethingNoBindingDevice        = New(http.StatusInternalServerError, "OnethingNoBindingDevice")
	ErrOnethingError                  = New(http.StatusInternalServerError, "OnethingError")
	ErrOnethingParseError             = New(http.StatusInternalServerError, "OnethingParseError")
	ErrOnethingBlockedForViolation    = New(http.StatusInternalServerError, "OnethingBlockedForViolation")
	ErrOnethingAccountExist           = New(http.StatusInternalServerError, "OnethingAccountExist")
	ErrOnethingBlockedForUnregistered = New(http.StatusInternalServerError, "OnethingBlockedForUnregistered")
)

Functions

func DumpErrorCodes added in v1.3.75

func DumpErrorCodes() string

func ErrStrResp added in v1.3.75

func ErrStrResp(status int, b any, format string, a ...any) error

func IsNotFound added in v1.3.75

func IsNotFound(err error) bool

func Len added in v1.3.75

func Len() int

func New added in v1.3.75

func New(errno int, opts ...string) func(errs ...error) *ErrorCode

Types

type ErrorCode added in v1.3.75

type ErrorCode struct {
	httpx.JsonResponse
}

func ErrHttpStatus added in v1.3.75

func ErrHttpStatus(status int) *ErrorCode

func (*ErrorCode) GetBadRequest added in v1.3.75

func (ec *ErrorCode) GetBadRequest() errcode_if.ErrorCodeIf

func (*ErrorCode) GetCode added in v1.3.75

func (ec *ErrorCode) GetCode() string

func (*ErrorCode) GetErrno added in v1.3.75

func (ec *ErrorCode) GetErrno() int

func (*ErrorCode) GetHttpStatus added in v1.3.75

func (ec *ErrorCode) GetHttpStatus() int

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

func (ec *ErrorCode) HttpCode() int

HttpCode required by interface httpx.JsonResponseError

func (*ErrorCode) NewRequestId added in v1.3.75

func (ec *ErrorCode) NewRequestId() string

func (*ErrorCode) ToCode added in v1.3.75

func (ec *ErrorCode) ToCode(errno int) string

func (*ErrorCode) ToHttpStatus added in v1.3.75

func (ec *ErrorCode) ToHttpStatus(errno int) int

func (*ErrorCode) ToHttpXJsonResponse added in v1.3.75

func (ec *ErrorCode) ToHttpXJsonResponse() *httpx.JsonResponse

ConvertJsonResponse implement HttpxJsonResponseWrapper

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL