errno

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OK 代表请求成功.
	OK = &Errno{HTTP: 200, Code: 0, Message: ""}

	// InternalServerError 表示所有未知的服务器端错误.
	InternalServerError = &Errno{HTTP: 200, Code: 1, Message: "Internal server error."}

	// ErrPageNotFound 表示路由不匹配错误.
	ErrPageNotFound = &Errno{HTTP: 200, Code: 404, Message: "Page not found."}

	// ErrBind 表示参数绑定错误.
	ErrBind = &Errno{HTTP: 200, Code: 1, Message: "Error occurred while binding the request body to the struct."}

	// ErrInvalidParameter 表示所有验证失败的错误.
	ErrInvalidParameter = &Errno{HTTP: 200, Code: 1, Message: "Parameter verification failed."}

	// ErrSignToken 表示签发 JWT Token 时出错.
	ErrSignToken = &Errno{HTTP: 200, Code: 401, Message: "Error occurred while signing the JSON web token."}

	// ErrTokenInvalid 表示 JWT Token 格式错误.
	ErrTokenInvalid = &Errno{HTTP: 200, Code: 401, Message: "Token was invalid."}

	// ErrUnauthorized 表示未授权访问.
	ErrUnauthorized = &Errno{HTTP: 200, Code: 401, Message: "Unauthorized access."}

	// ErrDBQuery 表示数据库查询错误.
	ErrDBQuery = &Errno{HTTP: 200, Code: 1, Message: "Database query error."}

	// ErrPhoneCodeLimit 表示手机号验证码发送次数限制.
	ErrPhoneCodeLimit = &Errno{HTTP: 200, Code: 1, Message: "Phone code limit."}

	// ErrPhoneCodeTimeLimit 表示手机号验证码发送频率限制.
	ErrPhoneCodeTimeLimit = &Errno{HTTP: 200, Code: 1, Message: "Phone code time limit."}
)
View Source
var (

	// ErrTokenMissing 表示请求头中没有令牌.
	ErrTokenMissing = &Errno{HTTP: 200, Code: 401, Message: "Token missing."}

	// ErrTokenExpired 表示令牌已过期.
	ErrTokenExpired = &Errno{HTTP: 200, Code: 401, Message: "Token expired."}

	// ErrTokenRefreshExpired 表示令牌刷新已过期.
	ErrTokenRefreshExpired = &Errno{HTTP: 200, Code: 401, Message: "Token refresh expired."}

	// ErrTokenRefreshFailed 表示令牌刷新失败.
	ErrTokenRefreshFailed = &Errno{HTTP: 200, Code: 401, Message: "Token refresh failed."}

	// ErrTokenRefreshInvalid 表示令牌刷新无效.
	ErrTokenRefreshInvalid = &Errno{HTTP: 200, Code: 401, Message: "Token refresh invalid."}
)
View Source
var (
	// ErrUserAlreadyExist 代表用户已经存在.
	ErrUserAlreadyExist = &Errno{HTTP: 200, Code: 1, Message: "User already exist."}

	// ErrUserNotFound 表示未找到用户.
	ErrUserNotFound = &Errno{HTTP: 200, Code: 1, Message: "User was not found."}

	// ErrPasswordIncorrect 表示密码不正确.
	ErrPasswordIncorrect = &Errno{HTTP: 200, Code: 1, Message: "Password was incorrect."}

	// ErrUserStatusDisable 表示用户状态禁用.
	ErrUserStatusDisable = &Errno{HTTP: 200, Code: 1, Message: "User status is disabled."}

	// ErrMissingUsernameOrEmail 缺少用户名或邮箱
	ErrMissingUsernameOrEmail = &Errno{HTTP: 200, Code: 1, Message: "Missing username or email."}
)

Functions

func Decode

func Decode(err error) (int, int, string)

Decode 尝试从 err 中解析出业务错误码和错误信息.

Types

type Errno

type Errno struct {
	HTTP    int
	Code    int
	Message string
}

Errno 定义了 biddingAI 使用的错误类型.

func (*Errno) Error

func (err *Errno) Error() string

Error 实现 error 接口中的 `Error` 方法.

func (*Errno) SetMessage

func (err *Errno) SetMessage(format string, args ...interface{}) *Errno

SetMessage 设置 Errno 类型错误中的 Message 字段.

Jump to

Keyboard shortcuts

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