errno

package
v0.0.0-...-db099c4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Common errors
	OK                  = &Errno{Code: 0, Message: "OK"}
	InternalServerError = &Errno{Code: 10001, Message: "Internal server error"}
	ErrBind             = &Errno{Code: 10002, Message: "Error occurred while binding the request body to the struct."}
	ErrParam            = &Errno{Code: 10003, Message: "参数有误"}
	ErrSignParam        = &Errno{Code: 10004, Message: "签名参数有误"}

	ErrValidation         = &Errno{Code: 20001, Message: "Validation failed."}
	ErrDatabase           = &Errno{Code: 20002, Message: "Database error."}
	ErrToken              = &Errno{Code: 20003, Message: "Error occurred while signing the JSON web token."}
	ErrInvalidTransaction = &Errno{Code: 20004, Message: "invalid transaction."}

	// user errors
	ErrEncrypt               = &Errno{Code: 20101, Message: "Error occurred while encrypting the user password."}
	ErrUserNotFound          = &Errno{Code: 20102, Message: "The user was not found."}
	ErrTokenInvalid          = &Errno{Code: 20103, Message: "The token was invalid."}
	ErrPasswordIncorrect     = &Errno{Code: 20104, Message: "The password was incorrect."}
	ErrAreaCodeEmpty         = &Errno{Code: 20105, Message: "手机区号不能为空"}
	ErrPhoneEmpty            = &Errno{Code: 20106, Message: "手机号不能为空"}
	ErrGenVCode              = &Errno{Code: 20107, Message: "生成验证码错误"}
	ErrSendSMS               = &Errno{Code: 20108, Message: "发送短信错误"}
	ErrSendSMSTooMany        = &Errno{Code: 20109, Message: "已超出当日限制,请明天再试"}
	ErrVerifyCode            = &Errno{Code: 20110, Message: "验证码错误"}
	ErrEmailOrPassword       = &Errno{Code: 20111, Message: "邮箱或密码错误"}
	ErrTwicePasswordNotMatch = &Errno{Code: 20112, Message: "两次密码输入不一致"}
	ErrRegisterFailed        = &Errno{Code: 20113, Message: "注册失败"}
)

nolint: golint

Functions

func DecodeErr

func DecodeErr(err error) (int, string)

DecodeErr 对错误进行解码,返回错误code和错误提示

Types

type Err

type Err struct {
	Code    int
	Message string
	Err     error
}

Err represents an error

func (*Err) Error

func (err *Err) Error() string

type Errno

type Errno struct {
	Code    int
	Message string
}

Errno 返回错误码和消息的结构体

func (Errno) Error

func (err Errno) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳