ex

package
v1.1.22 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BIZ     = 100000 // 普通业务异常
	GRPC    = 300000 // GRPC请求失败
	WS_WAIT = 999992 // WS等待响应超时
	WS_SEND = 999993 // WS发送数据失败
	JSON    = 999994 // JSON转换异常
	NUMBER  = 999995 // 数值转换异常
	DATA    = 999996 // 数据服务异常
	CACHE   = 999997 // 缓存服务异常
	SYSTEM  = 999998 // 系统级异常
	UNKNOWN = 999999 // 未知异常

	MQ                 = 800000 // MQ服务异常
	REDIS_LOCK_ACQUIRE = 800001 // redis锁获取失败
	REDIS_LOCK_PENDING = 800002 // redis锁正在处理
	REDIS_LOCK_TIMEOUT = 800003 // redis锁自旋超时
	REDIS_LOCK_RELEASE = 800004 // redis锁释放失败
	LOCAL_LOCK_ACQUIRE = 800005 // 本地锁获取失败
)
View Source
const (
	JSON_ERR    = "failed to respond to JSON data"
	GOB_ERR     = "failed to respond to GOB data"
	DATA_ERR    = "failed to loaded data service"
	DATA_C_ERR  = "failed to save data"
	DATA_R_ERR  = "failed to read data"
	DATA_U_ERR  = "failed to update data"
	DATA_D_ERR  = "failed to delete data"
	CACHE_ERR   = "failed to loaded cache service"
	CACHE_C_ERR = "failed to save cache data"
	CACHE_R_ERR = "failed to read cache data"
	CACHE_U_ERR = "failed to update cache data"
	CACHE_D_ERR = "failed to delete cache data"

	MQ_ERR      = "failed to loaded mq service"
	MQ_SEND_ERR = "failed to send mq data"
	MQ_REVD_ERR = "failed to receive mq data"
)

Variables

This section is empty.

Functions

func OutError added in v1.0.137

func OutError(title string, err error)

Types

type Throw

type Throw struct {
	// 24字节字段(slice)- 放在开头减少填充
	Arg []string // Additional arguments

	// 16字节字段(string)- 按对齐分组
	Msg    string // Error message
	Url    string // Related URL or endpoint
	ErrMsg string // Serialized error message (for error chain preservation)

	// 16字节字段(interface)- 与string对齐
	Err error `json:"-"` // Underlying error (not serialized)

	// 8字节字段(int)- 放在最后
	Code int // Error code
}

Throw represents a structured application error with additional context easyjson:json

func Catch

func Catch(err error) Throw

func (Throw) Error

func (self Throw) Error() string

func (Throw) MarshalEasyJSON added in v1.1.0

func (v Throw) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Throw) MarshalJSON added in v1.1.0

func (v Throw) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Throw) UnmarshalEasyJSON added in v1.1.0

func (v *Throw) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Throw) UnmarshalJSON added in v1.1.0

func (v *Throw) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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