errorcode

package
v0.0.0-...-5023f9f Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserLogin = &ErrorCode{Status: 400, Code: "user.login.fail", Message: "用户名或密码错误"}

	DBQuery = &ErrorCode{Status: 500, Code: "db.query.fail", Message: "数据库查询失败"}

	ErrParams = &ErrorCode{Status: 400, Code: "err.params", Message: "参数错误"}

	ErrUnKnown = &ErrorCode{Status: 500, Code: "err.unknown", Message: "未知错误"}
)

Functions

This section is empty.

Types

type ErrorCode

type ErrorCode struct {
	// Status 表示 http status or grpc code
	Status int `json:"-"`
	// Code 业务错误码
	// 规则: domain.reason,例如 user.login.fail
	Code string `json:"code"`
	// Message 业务错误原因
	Message string `json:"message"`
	// Data 附加的详细信息
	Data interface{} `json:"data"`
}

ErrorCode 错误码

func (*ErrorCode) Error

func (e *ErrorCode) Error() string

Error for error

Jump to

Keyboard shortcuts

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