mexception

package
v0.4.74 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERROR                     = Exception{1, "ERROR", ""}                     // 系统异常
	RunTimeException          = Exception{2, "RunTimeException", ""}          // 运行时异常
	NotFoundException         = Exception{3, "NotFoundException", ""}         // 不存在异常
	UnsupportedException      = Exception{4, "UnsupportedException", ""}      // 不支持
	IllegalParameterException = Exception{5, "IllegalParameterException", ""} // 非法参数
	EmptyException            = Exception{6, "EmptyException", ""}            // 空集合异常
	NilException              = Exception{7, "NilException", ""}              // 控制正异常
	DateTimeFormatException   = Exception{8, "DateTimeFormatException", ""}   // 日期格式化异常
	JsonParseException        = Exception{9, "JsonParseException", ""}        // JSON解析异常
	ParamsParseException      = Exception{10, "ParamsParseException", ""}     // 参数解析异常
	ValidationException       = Exception{11, "ValidationException", ""}      // 参数校验异常
	FileToMaxException        = Exception{12, "FileToMaxException", ""}       // 文件过大

	SQLException    = Exception{101, "SQLException", ""}    // sql 执行异常
	MongoException  = Exception{102, "MongoException", ""}  // mongodb 执行异常
	RedisException  = Exception{103, "RedisException", ""}  // redis 执行异常
	RabbitException = Exception{104, "RabbitException", ""} // rabbit 执行异常
)

Functions

func IsMException

func IsMException(err any) bool

func Message

func Message(err error) string

func NewError

func NewError(err error) error

func NewErrorEx

func NewErrorEx(ex Exception, err error) error

func NewException

func NewException(ex Exception, message string) error

Types

type Exception

type Exception struct {
	Code    int
	Name    string
	Message string
}

func (Exception) Error

func (ce Exception) Error() string

func (Exception) Msg added in v0.3.0

func (ce Exception) Msg(msg string) error

Jump to

Keyboard shortcuts

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