errorx

package
v0.11.29 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-10 21:51:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-01-08 16:55:06 * @FilePath: \go-toolbox\pkg\errorx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintErrorMap added in v0.11.15

func PrintErrorMap()

打印错误映射(调试用)

func RegisterError added in v0.11.15

func RegisterError(errType ErrorType, msg string)

RegisterError 注册错误类型和消息

func ResetErrorMap added in v0.11.15

func ResetErrorMap()

ResetErrorMap 重置错误映射

func WrapError

func WrapError(message string, err error) error

WrapError 是一个通用的错误包装函数

Types

type BaseError added in v0.11.15

type BaseError struct {
	// contains filtered or unexported fields
}

定义 BaseError 结构体

func NewBaseError added in v0.11.15

func NewBaseError(msg string) BaseError

NewBaseError 创建一个新的 BaseError 实例

func NewBaseErrorWithCtx added in v0.11.15

func NewBaseErrorWithCtx(ctx context.Context, msg string) BaseError

NewBaseErrorWithCtx 创建一个新的 BaseError Ctx 实例

func NewError added in v0.11.15

func NewError(errType ErrorType, args ...interface{}) BaseError

NewError 创建一个新的错误实例

func (BaseError) Error added in v0.11.15

func (e BaseError) Error() string

Error 实现 error 接口,返回错误信息

type ErrorMapType added in v0.11.15

type ErrorMapType map[ErrorType]string

错误映射类型

func GetErrorMap added in v0.11.15

func GetErrorMap() ErrorMapType

GetErrorMap 返回当前错误映射

type ErrorType added in v0.11.15

type ErrorType int

错误类型常量

Jump to

Keyboard shortcuts

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