errcode

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetCodeSuccess = 0
)

Variables

View Source
var (
	SUCCESS              = AppError{ErrorCode: 0, ErrorInfo: "SUCCESS"}
	INVALID_PARAMS       = AppError{ErrorCode: 40, ErrorInfo: "请求参数错误"}
	ID_NOT_EMPTY         = AppError{ErrorCode: 41, ErrorInfo: "ID为空"}
	ERROR_SERVER_ERROR   = AppError{ErrorCode: 50, ErrorInfo: "服务内部错误"}
	ERROR_DATA_NOT_EXIST = AppError{ErrorCode: 51, ErrorInfo: "记录不存在"}
	ERROR_CONFIG_PARSE   = AppError{ErrorCode: 52, ErrorInfo: "解析配置出错"}
	ERROR_LIMINT         = AppError{ErrorCode: 59, ErrorInfo: "請求過載"}
)

Functions

func GetSystemPanic

func GetSystemPanic(err interface{}) string

Types

type AppError

type AppError struct {
	ErrorCode int
	ErrorInfo string
}

func CustomError

func CustomError(appError AppError, errInfo string) AppError

自定义失败:错误码不变,在原错误信息的基础上,增加自定义错误信息

func NewError

func NewError(errCode int, errInfo string) AppError

func NewErrorByError

func NewErrorByError(appError AppError) *AppError

func (AppError) Error

func (a AppError) Error() string

func (AppError) ErrorCodeStr

func (a AppError) ErrorCodeStr() string

Jump to

Keyboard shortcuts

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