exceptions

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCode int = 0

Variables

This section is empty.

Functions

func TryCatch added in v0.1.1

func TryCatch(try func() (interface{}, error), catch func(error), finally func()) interface{}

Types

type CustomError

type CustomError struct {
	Code    int
	Message string
	Stack   string
}

CustomError 定义自定义错误类型

func Of

func Of(code int, message string) *CustomError

Of 创建一个新的自定义错误

func OfCode

func OfCode(errCode *ErrorCode) *CustomError

func OfMessage

func OfMessage(message string) *CustomError

func (*CustomError) Error

func (e *CustomError) Error() string

实现 error 接口

func (*CustomError) GetI18nMsgTemplate

func (e *CustomError) GetI18nMsgTemplate() string

type ErrorCode

type ErrorCode struct {
	Code    int
	Message string
}

func NewErrorCode

func NewErrorCode(code int, message string) *ErrorCode

Of 创建一个新的自定义错误

Jump to

Keyboard shortcuts

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