mrerr

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 6 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

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

func New

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

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) Id

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.1.1

func (e *AppError) TraceId() string

func (*AppError) Translate added in v0.1.1

func (e *AppError) Translate(loc 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) 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 Arg

type Arg map[string]any

func (Arg) String

func (a Arg) String() string

type ErrorKind

type ErrorKind int
const (
	ErrorIdInternal = "errInternal"

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

type FieldError

type FieldError struct {
	Id  string
	Err *AppError
}

type FieldErrorList

type FieldErrorList []FieldError

func NewList

func NewList(items ...FieldError) *FieldErrorList

func NewListWith

func NewListWith(fieldId string, err error) *FieldErrorList

func (*FieldErrorList) Add

func (e *FieldErrorList) Add(fieldId string, err error)

func (*FieldErrorList) Error

func (e *FieldErrorList) Error() string

Jump to

Keyboard shortcuts

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