errors

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 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")
)
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()
)

Functions

func Err

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

func ErrMCPTool

func ErrMCPTool(err error) *mcp.CallToolResult

func ErrorHandlerMiddleware

func ErrorHandlerMiddleware() gin.HandlerFunc

ErrorHandlerMiddleware is a Gin middleware that attaches a unique request ID to every request and writes a structured error response when errors occur.

func InvalidArg

func InvalidArg(arg string) error

func Is

func Is(err, target error) bool

func RecoveryMiddleware

func RecoveryMiddleware() gin.HandlerFunc

RecoveryMiddleware is a Gin middleware that recovers from panics and returns 500.

Types

type Error

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

func ChatRoomNotFound

func ChatRoomNotFound(key string) *Error

func ContactNotFound

func ContactNotFound(key string) *Error

func CreatePipeFileFailed

func CreatePipeFileFailed(cause error) *Error

func DBConnectFailed

func DBConnectFailed(path string, cause error) *Error

func DBFileNotFound

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

func DBInitFailed

func DBInitFailed(cause error) *Error

func DecodeKeyFailed

func DecodeKeyFailed(cause error) *Error

func DecryptCreateCipherFailed

func DecryptCreateCipherFailed(cause error) *Error

func FileGroupNotFound

func FileGroupNotFound(name string) *Error

func IncompleteRead

func IncompleteRead(cause error) *Error

func InitCacheFailed

func InitCacheFailed(cause error) *Error

func MediaTypeUnsupported

func MediaTypeUnsupported(_type string) *Error

func New

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

func Newf

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

func OpenFileFailed

func OpenFileFailed(path string, cause error) *Error

func OpenPipeFileFailed

func OpenPipeFileFailed(cause error) *Error

func PlatformUnsupported

func PlatformUnsupported(platform string, version int) *Error

func QueryFailed

func QueryFailed(query string, cause error) *Error

func ReadFileFailed

func ReadFileFailed(path string, cause error) *Error

func ReadMemoryFailed

func ReadMemoryFailed(cause error) *Error

func ReadPipeFileFailed

func ReadPipeFileFailed(cause error) *Error

func RunCmdFailed

func RunCmdFailed(cause error) *Error

func ScanRowFailed

func ScanRowFailed(cause error) *Error

func StatFileFailed

func StatFileFailed(path string, cause error) *Error

func TimeRangeNotFound

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

func WeChatAccountNotFound

func WeChatAccountNotFound(name string) *Error

func WeChatAccountNotOnline

func WeChatAccountNotOnline(name string) *Error

func WriteOutputFailed

func WriteOutputFailed(cause error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) String

func (e *Error) String() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

func (*Error) WithStack

func (e *Error) WithStack() *Error

Jump to

Keyboard shortcuts

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