Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidInput = errors.New("invalid input") ErrNotFound = errors.New("not found") ErrInternalServer = errors.New("internal server error") ErrDatabaseConnect = errors.New("database connection failed") ErrRedisConnect = errors.New("redis connection failed") ErrEncryptionFailed = errors.New("encryption failed") ErrDecryptionFailed = errors.New("decryption failed") )
定义常用错误类型
Functions ¶
Types ¶
type BusinessError ¶
type BusinessError struct {
Code int `json:"code"`
Message string `json:"message"`
Err error `json:"-"`
}
BusinessError 业务错误结构
func IsBusinessError ¶
func IsBusinessError(err error) (*BusinessError, bool)
IsBusinessError 检查是否为业务错误
func NewBusinessError ¶
func NewBusinessError(code int, message string, err error) *BusinessError
NewBusinessError 创建业务错误
func (*BusinessError) Error ¶
func (e *BusinessError) Error() string
func (*BusinessError) Unwrap ¶
func (e *BusinessError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.