coreError

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput     = errors.New("invalid input")
	ErrNotFound         = errors.New("not found")
	ErrUnauthorized     = errors.New("unauthorized")
	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

func WrapError

func WrapError(err error, message string) error

WrapError 包装错误

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

Jump to

Keyboard shortcuts

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