升级exception, 简化逻辑

This commit is contained in:
2025-05-10 18:19:11 +08:00
parent e8561a060c
commit be3556e23e
4 changed files with 58 additions and 115 deletions

View File

@ -15,16 +15,14 @@ package exception
type IException interface {
// Error 兼容 go 内置 error
Error() string
// GetCode 获取错误码
GetCode() interface{}
// GetMessage *获取错误信息
GetMessage() string
// GetData 获取异常时的返回数据
GetData() interface{}
// GetHttpCode 获取当前异常要返回的http状态码, 不设置则 默认 200
GetHttpCode() int
// Code 获取错误码
Code() any
// Message 获取错误信息
Message() string
// Data 获取异常时的返回数据
Data() map[string]any
// ToError 转换为内置error类型
ToError() error
// IsCode 是否为指定code
IsCode(code interface{}) bool
IsCode(code any) bool
}