errorsx

package
v1.0.0-beta.66 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppHandler

type AppHandler struct {
	Handler Handler
}

AppHandler contains some custom logic to handle an error.

func NewAppHandler

func NewAppHandler(handler Handler) AppHandler

func (AppHandler) Handle

func (h AppHandler) Handle(err error)

func (AppHandler) HandleContext

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

type ContextHandler

type ContextHandler struct {
	Handler Handler
}

ContextHandler always accepts a context.

func NewContextHandler

func NewContextHandler(handler Handler) ContextHandler

func (ContextHandler) Handle

func (h ContextHandler) Handle(ctx context.Context, err error)

func (ContextHandler) HandleContext

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

type Handler

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

Handler handles an error.

type NopHandler

type NopHandler struct{}

NopHandler ignores all errors.

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