errdefs

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput = NewCustomError(ErrTypeInvalidInput, "")
	ErrNotFound     = NewCustomError(ErrTypeNotFound, "")
	ErrConflict     = NewCustomError(ErrTypeConflict, "")
	ErrUnauthorized = NewCustomError(ErrTypeUnauthorized, "")
	ErrProvider     = NewCustomError(ErrTypeProvider, "")
	ErrUnsupported  = NewCustomError(ErrTypeUnsupported, "")
	ErrInternal     = NewCustomError(ErrTypeInternal, "")
)

Functions

func Register

func Register(t ErrorType, name string, status int)

Types

type CustomError

type CustomError struct {
	Type    ErrorType
	Message string
}

func NewCustomError

func NewCustomError(t ErrorType, message string) *CustomError

func (*CustomError) Error

func (e *CustomError) Error() string

func (*CustomError) GetStatus

func (e *CustomError) GetStatus() int

func (*CustomError) Is

func (e *CustomError) Is(target error) bool

type ErrorType

type ErrorType int
const (
	ErrTypeInvalidInput ErrorType = iota
	ErrTypeNotFound
	ErrTypeConflict
	ErrTypeUnauthorized
	ErrTypeProvider
	ErrTypeUnsupported
	ErrTypeInternal
)
const AppErrorBase ErrorType = 1000

AppErrorBase is where app-specific ErrorType values start; register them with Register during init, before any concurrent use.

func (ErrorType) String

func (e ErrorType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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