recovery

package module
v0.0.0-...-cd8656f Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

README

recurring-appointment

Recovery

github.com/auvitly/go-tools > recovery

Panic it's okay!

version

Package recovery provides methods for handling panic.


Documentation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do()

Do - perform panic processing with context. Called exclusively via defer.

func RegistryAsyncHandlers

func RegistryAsyncHandlers(handlers ...AsyncHandler)

RegistryAsyncHandlers - add handlers for global async execution.

func RegistryHandlers

func RegistryHandlers(handlers ...Handler)

RegistryHandlers - add handlers for global execution.

Types

type AsyncHandler

type AsyncHandler func(msg any)

AsyncHandler - async user panic handler.

type Builder

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

Builder - panic builder.

func On

func On(err **stderrs.Error) Builder

On - perform standard error enrichment.

func OnError

func OnError(err *error) Builder

OnError - perform error enrichment.

func SetMessage

func SetMessage(message string) Builder

SetMessage - set message for standard error.

func WithAsyncHandlers

func WithAsyncHandlers(handlers ...AsyncHandler) Builder

WithAsyncHandlers - add async exception handler.

func WithAsyncHandlersIf

func WithAsyncHandlersIf(condition bool, handlers ...AsyncHandler) Builder

WithAsyncHandlersIf - add async exception handler if the condition is met.

func WithField

func WithField(key string, value any) Builder

WithField - add a field to the target error.

func WithFieldIf

func WithFieldIf(condition bool, key string, value any) Builder

WithFieldIf - Add a field to the target error if the condition is met.

func WithFields

func WithFields(fields map[string]any) Builder

WithFields - add a fields to the target error.

func WithFieldsIf

func WithFieldsIf(condition bool, fields map[string]any) Builder

WithFieldsIf - Add a fields to the target error if the condition is met.

func WithHandlers

func WithHandlers(handlers ...Handler) Builder

WithHandlers - add exception handler.

func WithHandlersIf

func WithHandlersIf(condition bool, handlers ...Handler) Builder

WithHandlersIf - add exception handler if the condition is met.

func WithoutHandlers

func WithoutHandlers() Builder

WithoutHandlers - allows you to reset all handlers for the selected call.

func (Builder) Do

func (b Builder) Do()

Do - perform panic processing with context. Called exclusively via defer.

func (Builder) On

func (b Builder) On(err **stderrs.Error) Builder

On - perform standard error enrichment.

func (Builder) OnError

func (b Builder) OnError(err *error) Builder

OnError - perform error enrichment.

func (Builder) SetMessage

func (b Builder) SetMessage(message string) Builder

SetMessage - set message for standard error.

func (Builder) WithAsyncHandlers

func (b Builder) WithAsyncHandlers(handlers ...AsyncHandler) Builder

WithAsyncHandlers - add async exception handler.

func (Builder) WithAsyncHandlersIf

func (b Builder) WithAsyncHandlersIf(condition bool, handlers ...AsyncHandler) Builder

WithAsyncHandlersIf - add async exception handler if the condition is met.

func (Builder) WithField

func (b Builder) WithField(key string, value any) Builder

WithField - add a field to the target error.

func (Builder) WithFieldIf

func (b Builder) WithFieldIf(condition bool, key string, value any) Builder

WithFieldIf - Add a field to the target error if the condition is met.

func (Builder) WithFields

func (b Builder) WithFields(fields map[string]any) Builder

WithFields - add a fields to the target error.

func (Builder) WithFieldsIf

func (b Builder) WithFieldsIf(condition bool, fields map[string]any) Builder

WithFieldsIf - Add a fields to the target error if the condition is met.

func (Builder) WithHandlers

func (b Builder) WithHandlers(handlers ...Handler) Builder

WithHandlers - add exception handler.

func (Builder) WithHandlersIf

func (b Builder) WithHandlersIf(condition bool, handlers ...Handler) Builder

WithHandlersIf - add exception handler if the condition is met.

func (Builder) WithoutHandlers

func (b Builder) WithoutHandlers() Builder

WithoutHandlers - allows you to reset all handlers for the selected call.

type Handler

type Handler func(msg any) (err error)

Handler - user panic handler.

Jump to

Keyboard shortcuts

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