errors

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyDecrypted              = New(nil, http.StatusBadRequest, "database file is already decrypted")
	ErrDecryptHashVerificationFailed = New(nil, http.StatusBadRequest, "hash verification failed during decryption")
	ErrDecryptIncorrectKey           = New(nil, http.StatusBadRequest, "incorrect decryption key")
	ErrDecryptOperationCanceled      = New(nil, http.StatusBadRequest, "decryption operation was canceled")
	ErrNoMemoryRegionsFound          = New(nil, http.StatusBadRequest, "no memory regions found")
	ErrReadMemoryTimeout             = New(nil, http.StatusInternalServerError, "read memory timeout")
	ErrWeChatOffline                 = New(nil, http.StatusBadRequest, "WeChat is offline")
	ErrSIPEnabled                    = New(nil, http.StatusBadRequest, "SIP is enabled")
	ErrValidatorNotSet               = New(nil, http.StatusBadRequest, "validator not set")
	ErrNoValidKey                    = New(nil, http.StatusBadRequest, "no valid key found")
	ErrWeChatDLLNotFound             = New(nil, http.StatusBadRequest, "WeChatWin.dll module not found")
)
View Source
var (
	ErrTalkerEmpty     = New(nil, http.StatusBadRequest, "talker empty").WithStack()
	ErrKeyEmpty        = New(nil, http.StatusBadRequest, "key empty").WithStack()
	ErrMediaNotFound   = New(nil, http.StatusNotFound, "media not found").WithStack()
	ErrKeyLengthMust32 = New(nil, http.StatusBadRequest, "key length must be 32 bytes").WithStack()
)

Functions

func Err

func Err(c *gin.Context, err error)

func ErrMCPTool added in v0.0.22

func ErrMCPTool(err error) *mcp.CallToolResult

func ErrorHandlerMiddleware added in v0.0.2

func ErrorHandlerMiddleware() gin.HandlerFunc

ErrorHandlerMiddleware 是一个 Gin 中间件,用于统一处理请求过程中的错误 它会为每个请求生成一个唯一的请求 ID,并在错误发生时将其添加到错误响应中

func GetCode added in v0.0.2

func GetCode(err error) int

func HTTPShutDown added in v0.0.6

func HTTPShutDown(cause error) error

func InvalidArg added in v0.0.6

func InvalidArg(arg string) error

func Is added in v0.0.2

func Is(err, target error) bool

func RecoveryMiddleware added in v0.0.2

func RecoveryMiddleware() gin.HandlerFunc

RecoveryMiddleware 是一个 Gin 中间件,用于从 panic 恢复并返回 500 错误

func RootCause added in v0.0.2

func RootCause(err error) error

Types

type Error added in v0.0.6

type Error struct {
	Message string   `json:"message"` // 错误消息
	Cause   error    `json:"-"`       // 原始错误
	Code    int      `json:"-"`       // HTTP Code
	Stack   []string `json:"-"`       // 错误堆栈
}

func ChatRoomNotFound added in v0.0.6

func ChatRoomNotFound(key string) *Error

func ContactNotFound added in v0.0.6

func ContactNotFound(key string) *Error

func CreatePipeFileFailed added in v0.0.6

func CreatePipeFileFailed(cause error) *Error

func DBCloseFailed added in v0.0.6

func DBCloseFailed(cause error) *Error

func DBConnectFailed added in v0.0.6

func DBConnectFailed(path string, cause error) *Error

func DBFileNotFound added in v0.0.6

func DBFileNotFound(path, pattern string, cause error) *Error

数据库初始化相关错误

func DBInitFailed added in v0.0.6

func DBInitFailed(cause error) *Error

func DecodeKeyFailed added in v0.0.6

func DecodeKeyFailed(cause error) *Error

func DecryptCreateCipherFailed added in v0.0.2

func DecryptCreateCipherFailed(cause error) *Error

func FileGroupNotFound added in v0.0.11

func FileGroupNotFound(name string) *Error

func IncompleteRead added in v0.0.6

func IncompleteRead(cause error) *Error

func InitCacheFailed added in v0.0.6

func InitCacheFailed(cause error) *Error

func MediaTypeUnsupported added in v0.0.6

func MediaTypeUnsupported(_type string) *Error

func New

func New(cause error, code int, message string) *Error

func Newf added in v0.0.6

func Newf(cause error, code int, format string, args ...interface{}) *Error

func OpenFileFailed added in v0.0.6

func OpenFileFailed(path string, cause error) *Error

func OpenPipeFileFailed added in v0.0.6

func OpenPipeFileFailed(cause error) *Error

func OpenProcessFailed added in v0.0.6

func OpenProcessFailed(cause error) *Error

func PlatformUnsupported added in v0.0.2

func PlatformUnsupported(platform string, version int) *Error

func QueryFailed added in v0.0.6

func QueryFailed(query string, cause error) *Error

func ReadFileFailed added in v0.0.6

func ReadFileFailed(path string, cause error) *Error

func ReadMemoryFailed added in v0.0.6

func ReadMemoryFailed(cause error) *Error

func ReadPipeFileFailed added in v0.0.6

func ReadPipeFileFailed(cause error) *Error

func RefreshProcessStatusFailed added in v0.0.6

func RefreshProcessStatusFailed(cause error) *Error

func RunCmdFailed added in v0.0.6

func RunCmdFailed(cause error) *Error

func ScanRowFailed added in v0.0.6

func ScanRowFailed(cause error) *Error

func StatFileFailed added in v0.0.6

func StatFileFailed(path string, cause error) *Error

func TalkerNotFound added in v0.0.6

func TalkerNotFound(talker string) *Error

func TimeRangeNotFound added in v0.0.6

func TimeRangeNotFound(start, end time.Time) *Error

func WeChatAccountNotFound added in v0.0.6

func WeChatAccountNotFound(name string) *Error

func WeChatAccountNotOnline added in v0.0.6

func WeChatAccountNotOnline(name string) *Error

func Wrap added in v0.0.2

func Wrap(err error, message string, code int) *Error

func WriteOutputFailed added in v0.0.6

func WriteOutputFailed(cause error) *Error

func (*Error) Error added in v0.0.6

func (e *Error) Error() string

func (*Error) String added in v0.0.6

func (e *Error) String() string

func (*Error) Unwrap added in v0.0.6

func (e *Error) Unwrap() error

func (*Error) WithStack added in v0.0.6

func (e *Error) WithStack() *Error

Jump to

Keyboard shortcuts

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