transport

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorHandler

func NewErrorHandler(handler ErrorHandler) transport.ErrorHandler

NewErrorHandler turns an ErrorHandler (or an ErrorHandlerContext) into a go-kit compatible error handler.

Types

type ErrorHandler

type ErrorHandler interface {
	Handle(err error)
}

ErrorHandler is a generic error handler that allows applications (and libraries) to handle errors without worrying about the actual error handling strategy (logging, error tracking service, etc).

Compared to go-kit's error handler, it does not accept a context as the first parameter.

ErrorHandler is derived from https://godoc.org/emperror.dev/emperror#Handler

type ErrorHandlerContext

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

ErrorHandlerContext is an optional interface that MAY be implemented by an ErrorHandler. It is similar to ErrorHandler, but it receives a context as the first parameter. An implementation MAY extract information from the context and annotate err with it.

This interface is closer to go-kit's error handler, but the method name doesn't match, so it needs to be wrapped in a compatibility layer.

ErrorHandlerContext MAY honor the deadline carried by the context, but that's not a hard requirement.

ErrorHandlerContext is derived from https://godoc.org/emperror.dev/emperror#ContextAwareHandler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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