error

package
v0.0.0-...-462048f Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Provide()

Functions

func IsErrorType

func IsErrorType(err error, errType ErrorType) bool

Types

type AppError

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

func New

func New(errType ErrorType, message string) *AppError

func Wrap

func Wrap(errType ErrorType, err error) *AppError

func WrapWithContext

func WrapWithContext(errType ErrorType, err error, context map[string]interface{}) *AppError

func (*AppError) AddContext

func (e *AppError) AddContext(key string, value interface{}) *AppError

func (*AppError) Context

func (e *AppError) Context() map[string]interface{}

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) Type

func (e *AppError) Type() ErrorType

func (*AppError) Unwrap

func (e *AppError) Unwrap() error

type ErrorType

type ErrorType string
const (
	ErrorTypeNotFound      ErrorType = "NOT_FOUND"
	ErrorTypeValidation    ErrorType = "VALIDATION"
	ErrorTypeUnauthorized  ErrorType = "UNAUTHORIZED"
	ErrorTypeForbidden     ErrorType = "FORBIDDEN"
	ErrorTypeInternal      ErrorType = "INTERNAL"
	ErrorTypeDatabase      ErrorType = "DATABASE"
	ErrorTypeExternalAPI   ErrorType = "EXTERNAL_API"
	ErrorTypeUnprocessable ErrorType = "UNPROCESSABLE"
)

Jump to

Keyboard shortcuts

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