exception

package
v0.0.0-...-aefe3a2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERR_COMMON_BUSY         = ERR_COMMON + (iota + 1) // 服务器繁忙
	ERR_COMMON_REQ_TOOMANEY                           // 请求过多
	ERR_COMMON_BADPARAM                               // 参数错误
	ERR_COMMON_UNAUTH                                 // 登录失效
	ERR_COMMON_NOPERMISSION                           // 没有权限
	ERR_COMMON_USER                                   // 操作人错误
	ERR_COMMON_TIMEOUT                                // 超时
)

通用错误码

View Source
const (
	ERR_VERIFYCODE_SENDFAIL   = ERR_VERIFYCODE + (iota + 1) // 发送验证码失败
	ERR_VERIFYCODE_HASSEND                                  // 验证码已经发送过
	ERR_VERIFYCODE_HASEXPIRED                               // 验证码已经过期
)

验证码错误

View Source
const (
	ERR_BUSI_NOFOUND  = ERR_BUSI + (iota + 1) // 没有找到
	ERR_BUSI_HASEXIST                         // 已经存在
	ERR_BUSI_CREATE                           // 创建失败
	ERR_BUSI_UPDATE                           // 更新失败
	ERR_BUSI_DELETE                           // 删除失败
	ERR_BUSI_STATUS                           // 状态错误
)

业务错误

Variables

This section is empty.

Functions

This section is empty.

Types

type Exception

type Exception interface {
	Code() int32
	error
}

func New

func New(ex ExceptionType, s string) Exception

func Wrap

func Wrap(ex ExceptionType, err error, msgs ...string) Exception

type ExceptionType

type ExceptionType int32
const (
	ERR_COMMON     ExceptionType = (iota + 1) * 10000 // 通用错误码
	ERR_VERIFYCODE                                    // 验证码错误
	ERR_BUSI                                          // 通用业务操作错误
)

通用错误大类

func (ExceptionType) New

func (ex ExceptionType) New(s string) Exception

func (ExceptionType) Wrap

func (ex ExceptionType) Wrap(err error, msgs ...string) Exception

Jump to

Keyboard shortcuts

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