ecode

package
v0.0.0-...-ee87e3a Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 2 Imported by: 0

README

业务错误码定义

公共错误码已经在 github.com/go-eagle/eagle/pkg/errcode 包中,可以直接使用

业务的错误码可以根据模块按文件进行定义

使用时公共错误码 以 errno.开头,业务错误码以 ecode.开头

Demo

// 公共错误码
import "github.com/go-eagle/eagle/pkg/errcode"
...
errno.InternalServerError

// 业务错误码
import "github.com/go-eagle/eagle/internal/ecode"
...
ecode.ErrUserNotFound

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// common errors
	ErrInternalError   = errcode.New(10000, "Internal error")
	ErrInvalidArgument = errcode.New(10001, "Invalid argument")
	ErrNotFound        = errcode.New(10003, "Not found")
	ErrAccessDenied    = errcode.New(10006, "Access denied")
	ErrCanceled        = errcode.New(codes.Canceled, "RPC request is canceled")

	// user grpc errors
	ErrUserIsExist           = errcode.New(20100, "The user already exists.")
	ErrUserNotFound          = errcode.New(20101, "The user was not found.")
	ErrPasswordIncorrect     = errcode.New(20102, "账号或密码错误")
	ErrAreaCodeEmpty         = errcode.New(20103, "手机区号不能为空")
	ErrPhoneEmpty            = errcode.New(20104, "手机号不能为空")
	ErrGenVCode              = errcode.New(20105, "生成验证码错误")
	ErrSendSMS               = errcode.New(20106, "发送短信错误")
	ErrSendSMSTooMany        = errcode.New(20107, "已超出当日限制,请明天再试")
	ErrVerifyCode            = errcode.New(20108, "验证码错误")
	ErrEmailOrPassword       = errcode.New(20109, "邮箱或密码错误")
	ErrTwicePasswordNotMatch = errcode.New(20110, "两次密码输入不一致")
	ErrRegisterFailed        = errcode.New(20111, "注册失败")
	ErrToken                 = errcode.New(20112, "Gen token error")
	ErrEncrypt               = errcode.New(20113, "Encrypting the user password error")
)

nolint: golint

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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