apierror

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// 成功
	ApiCodeOk ApiCode = 0
	// 失败
	ApiCodeFailed ApiCode = 999

	// 验证码
	ApiCodeNeedCaptchaCode ApiCode = 10
	// 会话/Token已过期
	ApiCodeTokenExpiredCode ApiCode = 11
	// 文件不存在 NotFound.File
	ApiCodeFileNotFoundCode ApiCode = 12
	// 上传文件失败
	ApiCodeUploadFileStatusVerifyFailed = 13
	// 上传文件数据偏移值校验失败
	ApiCodeUploadOffsetVerifyFailed = 14
	// 服务器上传文件不存在
	ApiCodeUploadFileNotFound = 15
	// 文件已存在 AlreadyExist.File
	ApiCodeFileAlreadyExisted = 16
	// 上传达到日数量上限
	ApiCodeUserDayFlowOverLimited = 17
	// Token无效或者已过期 AccessTokenInvalid
	ApiCodeAccessTokenInvalid = 18
	// 被禁止 Forbidden
	ApiCodeForbidden = 19
	// RefreshToken已过期
	ApiCodeRefreshTokenExpiredCode ApiCode = 20
	// 文件不允许分享
	ApiCodeFileShareNotAllowed ApiCode = 21
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiCode

type ApiCode int

type ApiError

type ApiError struct {
	Code ApiCode
	Err  string
}

func NewApiError

func NewApiError(code ApiCode, err string) *ApiError

func NewApiErrorWithError

func NewApiErrorWithError(err error) *ApiError

func NewFailedApiError

func NewFailedApiError(err string) *ApiError

func NewOkApiError

func NewOkApiError() *ApiError

func ParseCommonApiError

func ParseCommonApiError(data []byte) *ApiError

ParseCommonApiError 解析公共错误,如果没有错误则返回nil

func (*ApiError) ErrCode

func (a *ApiError) ErrCode() ApiCode

func (*ApiError) Error

func (a *ApiError) Error() string

func (*ApiError) SetErr

func (a *ApiError) SetErr(code ApiCode, err string)

type ErrorResp

type ErrorResp struct {
	ErrorCode string `json:"code"`
	ErrorMsg  string `json:"message"`
}

ErrorResp 默认的错误信息

type ErrorXmlResp added in v0.0.2

type ErrorXmlResp struct {
	XMLName xml.Name `xml:"Error"`
	Code    string   `xml:"Code"`
	Message string   `xml:"Message"`
}

Jump to

Keyboard shortcuts

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