errorsx

package
v1.0.0-beta.191 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWarnError

func NewWarnError(err error) error

func WithPrefix

func WithPrefix(err error, prefix string) error

WithPrefix annotates an error with a prefix.

Types

type Handler

type Handler interface {
	Handle(err error)
	HandleContext(ctx context.Context, err error)
}

Handler handles an error. Same interface as httptransport.ErrorHandler.

type NopHandler

type NopHandler struct{}

NopHandler ignores all errors. Useful for testing.

func NewNopHandler

func NewNopHandler() NopHandler

func (NopHandler) Handle

func (h NopHandler) Handle(err error)

func (NopHandler) HandleContext

func (h NopHandler) HandleContext(ctx context.Context, err error)

type SlogHandler

type SlogHandler struct {
	Logger *slog.Logger
}

SlogHandler is a Handler that logs errors using slog.

func NewSlogHandler

func NewSlogHandler(logger *slog.Logger) SlogHandler

func (SlogHandler) Handle

func (h SlogHandler) Handle(err error)

func (SlogHandler) HandleContext

func (h SlogHandler) HandleContext(ctx context.Context, err error)

Jump to

Keyboard shortcuts

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