error

package
v0.0.0-...-af6c1de Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

type AppError struct {
	Name        ErrorName  `json:"name"`
	Level       ErrorLevel `json:"-"`
	Description string     `json:"description,omitempty"`
	Id          string     `json:"logId,omitempty"`
	Err         error      `json:"-"`
	Details     Map        `json:"details,omitempty"`
	// contains filtered or unexported fields
}

func Is

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

func New

func New(err error, name ErrorName, description string) *AppError

func (*AppError) AddDetail

func (e *AppError) AddDetail(key string, value any)

func (AppError) Error

func (e AppError) Error() string

func (*AppError) Merge

func (e *AppError) Merge(err error)

func (*AppError) Stack

func (e *AppError) Stack() string

type ErrorLevel

type ErrorLevel uint8
const (
	Info ErrorLevel = iota
	Warn
	Error
)

func (ErrorLevel) String

func (l ErrorLevel) String() string

type ErrorName

type ErrorName uint8
const (
	ServerError ErrorName = iota
	UnauthorizedError
	NotFoundError
	BadRequestError
	UnprocessableEntityError
	ForbiddenRequestError
)

func (ErrorName) Level

func (n ErrorName) Level() ErrorLevel

func (ErrorName) Status

func (n ErrorName) Status() int

func (ErrorName) String

func (n ErrorName) String() string

type Map

type Map map[string]any

Jump to

Keyboard shortcuts

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