globalError

package
v0.0.0-...-10cedd8 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthErr = 405

	ServerError        = 10101 // Internal Server Error
	ParamBindError     = 10102 // 参数信息有误
	AuthorizationError = 10103 // 签名信息有误
	CallHTTPError      = 10104 // 调用第三方HTTP接口失败
	ResubmitMsg        = 10105 // 请勿重复提交

	GetError    = 20101
	CreateError = 20102
	DeleteError = 20103
	UpdateError = 20104

	LoginErr  = 30101
	LogoutErr = 30102
)

2、定义errorCode

Variables

This section is empty.

Functions

func GetErrorMsg

func GetErrorMsg(code int) string

func NewGlobalError

func NewGlobalError(code int, err error) error

NewGlobalError 4、新建自定义error实例化

Types

type GlobalError

type GlobalError struct {
	Code             int    `json:"code"`    // 业务码
	Message          string `json:"message"` // 业务码
	RealErrorMessage string `json:"err_msg"`
}

func (*GlobalError) Error

func (e *GlobalError) Error() string

Jump to

Keyboard shortcuts

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