errorhandler

package
v0.0.0-...-0c438d6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCallWrapper

func NewCallWrapper(opts ...Option) client.CallWrapper

NewCallWrapper creates a new call wrapper for error handling with retry logic

func NewClientWrapper

func NewClientWrapper(opts ...Option) client.Wrapper

NewClientWrapper creates a new client wrapper for error handling

func NewHandlerWrapper

func NewHandlerWrapper(opts ...Option) server.HandlerWrapper

NewHandlerWrapper creates a new handler wrapper for standardized error handling

Types

type Config

type Config struct {
	IncludeErrorDetails *bool `yaml:"include_error_details,omitempty"`
	LogErrors           *bool `yaml:"log_errors,omitempty"`
	MaxRetries          *int  `yaml:"max_retries,omitempty"`
}

type Option

type Option func(*Options)

Option function for setting options

func WithConfig

func WithConfig(cfg *Config) Option

func WithIncludeErrorDetails

func WithIncludeErrorDetails(include bool) Option

WithIncludeErrorDetails sets whether to include error details in responses

func WithLogErrors

func WithLogErrors(log bool) Option

WithLogErrors sets whether to log errors

func WithMaxRetries

func WithMaxRetries(retries int) Option

WithMaxRetries sets the maximum number of retries

type Options

type Options struct {
	IncludeErrorDetails bool
	LogErrors           bool
	MaxRetries          int
	RetryEnabled        bool
}

Options for the error handler middleware

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns default options

Source Files

  • options.go
  • wrappers.go

Jump to

Keyboard shortcuts

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