apperr

package
v1.0.54 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is

func Is(err, target error) bool

func Translate

func Translate(err Error, lang string) (string, string)

Types

type Annotator added in v1.0.42

type Annotator func(*Error)

func WithCode added in v1.0.42

func WithCode(code code.Code) Annotator

func WithContext added in v1.0.42

func WithContext(context string) Annotator

func WithID added in v1.0.42

func WithID(id string) Annotator

func WithShowMessage added in v1.0.42

func WithShowMessage(showMessage bool) Annotator

func WithText added in v1.0.42

func WithText(text string) Annotator

func WithTextTranslate added in v1.0.42

func WithTextTranslate(tr translate.Translate) Annotator

func WithTitle added in v1.0.42

func WithTitle(title string) Annotator

func WithTitleTranslate added in v1.0.42

func WithTitleTranslate(tr translate.Translate) Annotator

type Error added in v1.0.42

type Error struct {
	ID                 string
	Context            string
	ShowMessage        bool
	Code               code.Code
	Text               string
	TextTranslate      translate.Translate
	TextTranslateArgs  []interface{}
	Title              string
	TitleTranslate     translate.Translate
	TitleTranslateArgs []interface{}
	Err                error
}

func New

func New(id string, annotators ...Annotator) Error

func Replace added in v1.0.42

func Replace(err Error, annotators ...Annotator) Error

func Unwrap added in v1.0.42

func Unwrap(err Error) Error

func (Error) Error added in v1.0.42

func (e Error) Error() string

func (Error) GetIDSuffix added in v1.0.42

func (e Error) GetIDSuffix() string

func (Error) LastError added in v1.0.45

func (e Error) LastError() error

func (Error) NewID added in v1.0.42

func (e Error) NewID(id string) Error

func (Error) WithError added in v1.0.42

func (e Error) WithError(err error) Error

func (Error) WithTextArgs added in v1.0.42

func (e Error) WithTextArgs(args ...any) Error

func (Error) WithTitleArgs added in v1.0.42

func (e Error) WithTitleArgs(args ...any) Error

Directories

Path Synopsis
utils
x

Jump to

Keyboard shortcuts

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