mrerr

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 12

Documentation

Index

Constants

View Source
const (
	ErrorInternalID = "errInternal"
	ErrorSystemID   = "errSystem"
)

Variables

This section is empty.

Functions

func SetCallerOptions added in v0.5.3

func SetCallerOptions(opts ...CallerOption)

SetCallerOptions - WARNING: use only when starting the main process

Types

type AppError

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

func New

func New(id, message string, args ...any) *AppError

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) ID added in v0.3.6

func (e *AppError) ID() string

func (*AppError) Is

func (e *AppError) Is(err error) bool

func (*AppError) Kind

func (e *AppError) Kind() ErrorKind

func (*AppError) TraceID added in v0.3.6

func (e *AppError) TraceID() string

func (*AppError) Translate added in v0.1.1

func (e *AppError) Translate(locale *mrlang.Locale) mrlang.ErrorMessage

Translate - translate error message for user

func (*AppError) Unwrap

func (e *AppError) Unwrap() error

type AppErrorFactory

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

func NewFactory

func NewFactory(id string, kind ErrorKind, message string) *AppErrorFactory

func (*AppErrorFactory) Caller

func (e *AppErrorFactory) Caller(skip int) *AppErrorFactory

func (*AppErrorFactory) ErrorID added in v0.5.2

func (e *AppErrorFactory) ErrorID() string

func (*AppErrorFactory) Is

func (e *AppErrorFactory) Is(err error) bool

Is - see: AppError::Is

func (*AppErrorFactory) New

func (e *AppErrorFactory) New(args ...any) *AppError

func (*AppErrorFactory) Wrap

func (e *AppErrorFactory) Wrap(err error, args ...any) *AppError

type CallStackRow added in v0.5.3

type CallStackRow struct {
	File string
	Line int
}

type Caller added in v0.5.3

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

func NewCaller added in v0.5.3

func NewCaller(opts ...CallerOption) *Caller

func (*Caller) CallStack added in v0.5.3

func (c *Caller) CallStack(skip int) []CallStackRow

type CallerOption added in v0.6.0

type CallerOption func(c *Caller)

func CallerDeep added in v0.6.0

func CallerDeep(value int) CallerOption

func CallerRootPath added in v0.6.0

func CallerRootPath(value string) CallerOption

func CallerUseShortPath added in v0.6.0

func CallerUseShortPath(value bool) CallerOption

type ErrorKind

type ErrorKind int8
const (
	ErrorKindInternal       ErrorKind = iota // внутренняя ошибка + traceID + call stack
	ErrorKindInternalNotice                  // внутреннее предупреждение, которое, в некоторых случаях, может стать поводом для реальной ошибки
	ErrorKindSystem                          // системная ошибка + traceID + call stack
	ErrorKindUser                            // пользовательская ошибка
)

func (ErrorKind) String added in v0.5.0

func (k ErrorKind) String() string

type FieldError

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

func NewFieldError added in v0.4.0

func NewFieldError(id string, err error) *FieldError

func NewFieldErrorAppError added in v0.5.0

func NewFieldErrorAppError(id string, err *AppError) *FieldError

func NewFieldErrorMessage added in v0.5.0

func NewFieldErrorMessage(id string, message string) *FieldError

func (*FieldError) AppError added in v0.4.0

func (e *FieldError) AppError() *AppError

func (*FieldError) Error added in v0.4.0

func (e *FieldError) Error() string

func (*FieldError) ID added in v0.3.6

func (e *FieldError) ID() string

type FieldErrorList

type FieldErrorList []*FieldError

func (FieldErrorList) Error

func (l FieldErrorList) Error() string

Jump to

Keyboard shortcuts

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