errors

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoType = ErrType(iota)
	Runtime
	Domain
	Debug
)
View Source
const ServerErrTitle = "Server error, please try again later"
View Source
const ValidationErrCode = 101

Variables

This section is empty.

Functions

func AddContext

func AddContext(ctx context.Context, err error) error

func AddErrLocalize

func AddErrLocalize(err error, localize *i18n.Localize) error

func AddErrLocalizeData

func AddErrLocalizeData(err error, data map[string]any) error

func AddErrLocalizePluralCount

func AddErrLocalizePluralCount(err error, pluralCount any) error

func AddErrorCode

func AddErrorCode(err error, code int) error

func AddErrorData

func AddErrorData(err error, field string, data any) error

func DomainErrWithCode

func DomainErrWithCode(msg string, code int) error

func DomainErrWithCodeT

func DomainErrWithCodeT(msg, msgID string, code int) error

func DomainErrWithDefaultCode

func DomainErrWithDefaultCode(msg string) error

func DomainErrWithDefaultCodeT

func DomainErrWithDefaultCodeT(msg, msgID string) error

func GetContext

func GetContext(err error) context.Context

func GetErrorCode

func GetErrorCode(err error) int

func GetErrorData

func GetErrorData(err error, key string) any

func Handle

func Handle(err error) error

func IsDebugError

func IsDebugError(err error) bool

func IsDomainError

func IsDomainError(err error) bool

func IsRuntimeError

func IsRuntimeError(err error) bool

func Log

func Log(err error)

func New

func New(msg string) error

func NewTfDomainErrWidthCode

func NewTfDomainErrWidthCode(msg, msgID string, code int, namedArgs map[string]any, pluralCount any) error

func Newf

func Newf(msg string, args ...any) error

func NewfDomainErrWidthCode

func NewfDomainErrWidthCode(msg string, code int, args ...any) error

func Wrap

func Wrap(err error, msg string) error

func Wrapf

func Wrapf(err error, msg string, args ...any) error

Types

type ErrHandler

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

func InitHandler

func InitHandler(debug bool, logger zerolog.Logger, client *sentry.Client) ErrHandler

func (ErrHandler) Handle

func (h ErrHandler) Handle(err error) error

func (ErrHandler) Log

func (h ErrHandler) Log(err error)

func (ErrHandler) SentryLog

func (h ErrHandler) SentryLog(err error, lvl sentry.Level)

type ErrType

type ErrType uint

func GetType

func GetType(err error) ErrType

func (ErrType) New

func (t ErrType) New(msg string) error

func (ErrType) NewT

func (t ErrType) NewT(msg, msgID string) error

func (ErrType) NewTf

func (t ErrType) NewTf(msg, msgID string, namedArgs map[string]any, pluralCount any) error

func (ErrType) Newf

func (t ErrType) Newf(msg string, args ...any) error

func (ErrType) Wrap

func (t ErrType) Wrap(err error, msg string) error

func (ErrType) WrapT

func (t ErrType) WrapT(err error, msg, msgID string) error

func (ErrType) WrapTf

func (t ErrType) WrapTf(err error, msg, msgID string, namedArgs map[string]any, pluralCount any) error

func (ErrType) Wrapf

func (t ErrType) Wrapf(err error, msg string, args ...any) error

Jump to

Keyboard shortcuts

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