Documentation
¶
Overview ¶
Package errors extends the errors package in the stdlib.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler interface {
Handle(err error)
}
Handler is responsible for handling an error.
This interface allows libraries to decouple from logging solutions. In most cases the implementation will provide some log functionalities though.
func NewLogHandler ¶
func NewLogHandler(logger errorLogger) Handler
NewLogHandler returns a new LogHandler.
type LogHandler ¶
type LogHandler struct {
// contains filtered or unexported fields
}
LogHandler accepts an errorLogger instance and logs an error.
Compatible with most level-based loggers.
func (*LogHandler) Handle ¶
func (h *LogHandler) Handle(err error)
Handle takes care of an error by logging it.
type NullHandler ¶
type NullHandler struct{}
NullHandler throws every error away.
func (*NullHandler) Handle ¶
func (h *NullHandler) Handle(err error)
Handle does the actual throwing away.
type TestHandler ¶
type TestHandler struct {
// contains filtered or unexported fields
}
TestHandler is a test implementation of errors.Handler
func (*TestHandler) Errors ¶
func (h *TestHandler) Errors() []error
Errors returns the list of handled errors.
func (*TestHandler) Handle ¶
func (h *TestHandler) Handle(err error)
Handle takes care of an error by logging it.