errtag

package
v0.0.0-...-5a4f27c Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsTag

func AsTag[T Tagger](err error) (T, bool)

func HasTag

func HasTag[T Tagger](err error) bool

func NewTagged

func NewTagged[T Tagger, TP TaggerPtr[T]](cause string, opts ...Option) error

func Tag

func Tag[T Tagger, TP TaggerPtr[T]](cause error, opts ...Option) T

Types

type Coder

type Coder interface {
	Code() int
}

type Conflict

type Conflict struct{ ErrorTag[codeConflict] }

type ErrorTag

type ErrorTag[C Coder] struct {
	// contains filtered or unexported fields
}

func (ErrorTag[C]) Cause

func (t ErrorTag[C]) Cause() error

func (ErrorTag[C]) Code

func (t ErrorTag[C]) Code() int

func (ErrorTag[C]) Details

func (t ErrorTag[C]) Details() []string

func (ErrorTag[C]) Error

func (t ErrorTag[C]) Error() string

func (ErrorTag[C]) Msg

func (t ErrorTag[C]) Msg() string

func (ErrorTag[C]) Unwrap

func (t ErrorTag[C]) Unwrap() error

type Forbidden

type Forbidden struct{ ErrorTag[forbidden] }

type Internal

type Internal struct{ ErrorTag[codeInternal] }

type InvalidArgument

type InvalidArgument struct{ ErrorTag[codeBadRequest] }

type NotFound

type NotFound struct{ ErrorTag[codeNotFound] }

type Option

type Option func(m *tagMeta)

func WithDetails

func WithDetails(details ...string) Option

func WithMsg

func WithMsg(message string) Option

func WithMsgf

func WithMsgf(format string, a ...any) Option

type Tagger

type Tagger interface {
	error
	Code() int
	Msg() string
	Details() []string
}

type TaggerPtr

type TaggerPtr[T any] interface {
	*T
	// contains filtered or unexported methods
}

type Unauthorized

type Unauthorized struct{ ErrorTag[codeUnauthorized] }

Jump to

Keyboard shortcuts

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