errp

package
v4.14.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 1 Imported by: 135

Documentation

Overview

Package errp wraps the github.com/pkg/errors package, because its name clashes with the builtin errors package, which confuses the automatic imports tool goimports.

Index

Constants

This section is empty.

Variables

View Source
var (
	// New wraps errors.New
	New = errors.New
	// Newf wraps errors.Newf
	Newf = errors.Errorf
	// WithStack wraps errors.WithStack
	WithStack = errors.WithStack
	// Cause wraps errors.Cause
	Cause = errors.Cause
	// Wrap wraps errors.Wrap
	Wrap = errors.Wrap
	// WithMessage wraps errors.WithMessage
	WithMessage = errors.WithMessage
)

Functions

This section is empty.

Types

type Context

type Context map[string]interface{}

Context provides the context for a detailed error.

type DetailedError

type DetailedError struct {
	Data Context
	Err  error
}

DetailedError combines an error with a map of data points that provide more context and are useful for logging.

func WithContext

func WithContext(err error, data Context) *DetailedError

WithContext takes an error and a data map and provides a DetailedError that combines both.

func (DetailedError) Error

func (detailedError DetailedError) Error() string

Jump to

Keyboard shortcuts

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