errorsx

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func IgnoreAlreadyExists

func IgnoreAlreadyExists(err error) error

func IgnoreNotFound

func IgnoreNotFound(err error) error

func MustHandle

func MustHandle(err error, handlers ...func(error) error)

Types

type CategoryMatcher

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

func NewCategoryMatcher

func NewCategoryMatcher(c ...ErrorCategory) *CategoryMatcher

func (*CategoryMatcher) Match

func (m *CategoryMatcher) Match(err error) bool

type CodeMatcher

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

func NewCodeMatcher

func NewCodeMatcher(c ...codes.Code) *CodeMatcher

func (*CodeMatcher) Match

func (m *CodeMatcher) Match(err error) bool

type ErrorAction

type ErrorAction int
const (
	ActionNone ErrorAction = iota
	ActionRetry
	ActionReauth
	ActionForbidden
	ActionNotFound
	ActionBadRequest
	ActionRateLimit
	ActionFailover
	ActionEscalate
)

func (ErrorAction) String

func (a ErrorAction) String() string

type ErrorCategory

type ErrorCategory int
const (
	CategoryUnknown ErrorCategory = iota
	CategoryClient
	CategoryServer
	CategoryNetwork
	CategoryAuth
	CategoryValidation
	CategoryRateLimit
)

func (ErrorCategory) String

func (c ErrorCategory) String() string

type ErrorDetails

type ErrorDetails struct {
	Code            string
	GRPCCode        codes.Code
	Message         string
	Category        ErrorCategory
	IsRetryable     bool
	IsClientError   bool
	IsServerError   bool
	SuggestedAction ErrorAction
	RetryAfter      time.Duration
}

func Analyze

func Analyze(err error) *ErrorDetails

type ErrorHandler

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

func NewErrorHandler

func NewErrorHandler() *ErrorHandler

func (*ErrorHandler) Fallback

func (h *ErrorHandler) Fallback(handler func(error) error) *ErrorHandler

func (*ErrorHandler) Handle

func (h *ErrorHandler) Handle(err error) error

func (*ErrorHandler) On

func (h *ErrorHandler) On(code codes.Code, handler func(error) error) *ErrorHandler

func (*ErrorHandler) OnAuth

func (h *ErrorHandler) OnAuth(handler func(error) error) *ErrorHandler

func (*ErrorHandler) OnNetwork

func (h *ErrorHandler) OnNetwork(handler func(error) error) *ErrorHandler

func (*ErrorHandler) OnNotFound

func (h *ErrorHandler) OnNotFound(handler func(error) error) *ErrorHandler

type ErrorMatcher

type ErrorMatcher interface {
	Match(err error) bool
}

Jump to

Keyboard shortcuts

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