Documentation
¶
Index ¶
- Variables
- func DumpErrorCodes() string
- func ErrStrResp(status int, b any, format string, a ...any) error
- func Len() int
- type ErrorCode
- func (ec *ErrorCode) GetBadRequest() errcodex.ErrorCodeIf
- func (ec *ErrorCode) GetCode() string
- func (ec *ErrorCode) GetErrno() int
- func (ec *ErrorCode) GetHttpStatus() int
- func (ec *ErrorCode) GetInternalError() errcodex.ErrorCodeIf
- func (ec *ErrorCode) GetSuccess() errcodex.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) ToStringWithStack()
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OK = newErrCode(http.StatusOK) ErrInvalidErrorCode = &ErrorCode{httpx.JsonResponse{ Status: 0, Errno: constInvalidErrorBaseIndex, Code: "FatalErrorInvalidErrorCode", }} // Code == http status ErrSuccess = funcNewErrCode(http.StatusOK) ErrBatchError = funcNewErrCode(http.StatusOK, "InternalServerError") ErrPartlyOk = funcNewErrCode(http.StatusOK, "PartlyOk") ErrErrorFound = funcNewErrCode(http.StatusOK, "ErrorFound") ErrInsufficientStorage = funcNewErrCode(http.StatusInsufficientStorage) ErrInternalServerError = funcNewErrCode(http.StatusInternalServerError) ErrTimeout = funcNewErrCode(http.StatusGatewayTimeout) ErrForbidden = funcNewErrCode(http.StatusForbidden) ErrNotFound = funcNewErrCode(http.StatusNotFound) ErrConflict = funcNewErrCode(http.StatusConflict) ErrPreconditionFailed = funcNewErrCode(http.StatusPreconditionFailed) ErrTooManyRequests = funcNewErrCode(http.StatusTooManyRequests) ErrNotImplemented = funcNewErrCode(http.StatusNotImplemented) ErrFailedDependency = funcNewErrCode(http.StatusFailedDependency, "No storage") ErrMaxBindingLimited = funcNewErrCode(http.StatusBadRequest, "MaxBindingLimited") ErrBadRequest = funcNewErrCode(http.StatusBadRequest) ErrUnsupportedDevice = funcNewErrCode(http.StatusBadRequest, "UnsupportedDevice") ErrMissPublicParameter = funcNewErrCode(http.StatusBadRequest, "MissPublicParameter") ErrInvalidSumAlgo = funcNewErrCode(http.StatusBadRequest, "InvalidSumAlgo") ErrIsDirectory = funcNewErrCode(http.StatusBadRequest, "TargetIsDirectory") ErrSourceIsParent = funcNewErrCode(http.StatusBadRequest, "SourceIsParent") ErrExpiredRequest = funcNewErrCode(http.StatusBadRequest, "ExpiredRequest") ErrObjectExist = funcNewErrCode(http.StatusBadRequest, "ObjectExist") ErrObjectNotExist = funcNewErrCode(http.StatusBadRequest, "ObjectNotExist") ErrSessionNotExist = funcNewErrCode(http.StatusBadRequest, "SessionNotExist") ErrNoNeedUpgrade = funcNewErrCode(http.StatusBadRequest, "NoNeedUpgrade") ErrUserExist = funcNewErrCode(http.StatusBadRequest, "UserExist") ErrWrongSign = funcNewErrCode(http.StatusBadRequest, "WrongSign") ErrInvalidVrfCode = funcNewErrCode(http.StatusBadRequest, "InvalidSmsCode") ErrExpiredVrfCode = funcNewErrCode(http.StatusBadRequest, "ExpiredSmsCode") ErrInvalidDeviceId = funcNewErrCode(http.StatusBadRequest, "InvalidDeviceId") ErrAlreadyFormated = funcNewErrCode(http.StatusBadRequest, "AlreadyFormated") ErrDeviceAlreadyBound = funcNewErrCode(http.StatusBadRequest, "DeviceAlreadyBound") ErrDeviceOffline = funcNewErrCode(http.StatusBadRequest, "DeviceOffline") ErrInvalidJwt = funcNewErrCode(http.StatusUnauthorized, "InvalidJwt") ErrInvalidPassword = funcNewErrCode(http.StatusUnauthorized, "InvalidPassword") ErrInvalidNonce = funcNewErrCode(http.StatusUnauthorized, "InvalidNonce") ErrExpiredNonce = funcNewErrCode(http.StatusUnauthorized, "ExpiredNonce") ErrInvalidSign = funcNewErrCode(http.StatusUnauthorized, "InvalidSign") ErrExpiredToken = funcNewErrCode(http.StatusUnauthorized, "ExpiredToken") ErrInvalidToken = funcNewErrCode(http.StatusUnauthorized, "InvalidToken") ErrInvalidIssuer = funcNewErrCode(http.StatusUnauthorized, "InvalidIssuer") //4XXX 调用方错误 //5XXX 服务器内部错误 ErrConflictConnection = funcNewErrCode(http.StatusInternalServerError, "ConflictConnection") ErrInvalidDataType = funcNewErrCode(http.StatusInternalServerError, "InvalidDataType") ErrEmptyKey = funcNewErrCode(http.StatusInternalServerError, "EmptyKey") ErrEmptyPassword = funcNewErrCode(http.StatusInternalServerError, "EmptyPassword") ErrRootUserDeletion = funcNewErrCode(http.StatusInternalServerError, "RootUserDeletion") )
Functions ¶
func DumpErrorCodes ¶
func DumpErrorCodes() string
Types ¶
type ErrorCode ¶
type ErrorCode struct {
httpx.JsonResponse
}
func ErrHttpStatus ¶
func (*ErrorCode) GetBadRequest ¶
func (ec *ErrorCode) GetBadRequest() errcodex.ErrorCodeIf
func (*ErrorCode) GetHttpStatus ¶
func (*ErrorCode) GetInternalError ¶
func (ec *ErrorCode) GetInternalError() errcodex.ErrorCodeIf
func (*ErrorCode) GetSuccess ¶
func (ec *ErrorCode) GetSuccess() errcodex.ErrorCodeIf
func (*ErrorCode) NewRequestId ¶
func (*ErrorCode) ToHttpStatus ¶
func (*ErrorCode) ToStringWithStack ¶
func (ec *ErrorCode) ToStringWithStack()
Click to show internal directories.
Click to hide internal directories.