apierror

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

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

	// 验证码
	ApiCodeNeedCaptchaCode ApiCode = 10
	// 会话/Token已过期
	ApiCodeTokenExpiredCode ApiCode = 11
	// 文件不存在
	ApiCodeFileNotFoundCode ApiCode = 12
	// 上传文件失败
	ApiCodeUploadFileStatusVerifyFailed = 13
	// 上传文件数据偏移值校验失败
	ApiCodeUploadOffsetVerifyFailed = 14
	// 服务器上传文件不存在
	ApiCodeUploadFileNotFound = 15
	// 文件已存在
	ApiCodeFileAlreadyExisted = 16
	// 上传达到日数量上限
	ApiCodeUserDayFlowOverLimited = 17
	// 参数无效,或者token过期
	ApiCodeInvalidArgument = 18
	// 敏感文件,禁止上传
	ApiCodeInfoSecurityError = 19
)

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 ParseAppCommonApiError added in v0.0.6

func ParseAppCommonApiError(data []byte) *ApiError

ParseAppCommonApiError 解析公共错误,如果没有错误则返回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 AppErrorXmlResp

type AppErrorXmlResp struct {
	XMLName xml.Name `xml:"error"`
	Code    string   `xml:"code"`
	Message string   `xml:"message"`
}

type ErrorResp

type ErrorResp struct {
	ErrorCode string `json:"errorCode"`
	ErrorMsg  string `json:"errorMsg"`
}

ErrorResp 默认的错误信息

type SuccessResp

type SuccessResp struct {
	// Success 是否成功。true为成功,false或者没有返回则为失败
	Success bool `json:"success"`
}

Jump to

Keyboard shortcuts

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