errors

package
v0.0.0-...-5c345c6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2016 License: MIT Imports: 6 Imported by: 0

README

errors

errors

Package errors provides richer error handling functionality

Errors created or wrapped include a stack trace, optional additional context messages, and optional additional relevant data.

Usage

func Cause
func Cause(e error) error

Cause returns the original cause of the error.

func New
func New(msg string) error

New returns a new error with callstack that formats as the given text.

func Newf
func Newf(format string, args ...interface{}) error

Newf returns a new error with callstack that formats according to a format specifier.

func Newv
func Newv(msg string, values map[string]interface{}) error

Newv returns a new error with the callstack that formats as the given text and associates the supplied data with the error.

func ResetStack
func ResetStack(err error) error

ResetStack generates a new stack trace for the error at the current location if one was present.

func Wrap
func Wrap(err error, msg ...string) error

Wrap wraps an error, creating a callstack if necessary and prefixing the underlying error message with the optional given text.

func Wrapf
func Wrapf(err error, format string, args ...interface{}) error

Wrapf wraps an error, creating a callstack if necessary and prefixing the underlying error message with the given text formatted with the specifier.

func Wrapv
func Wrapv(err error, values map[string]interface{}, msg ...string) error

Wrapv wraps an error, creating a callstack if necessary and associating the supplied data with the error.

-- Generated with godocdown

Documentation

Overview

Package errors provides richer error handling functionality

Errors created or wrapped include a stack trace, optional additional context messages, and optional additional relevant data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(e error) error

Cause returns the original cause of the error.

func New

func New(msg string) error

New returns a new error with callstack that formats as the given text.

func Newf

func Newf(format string, args ...interface{}) error

Newf returns a new error with callstack that formats according to a format specifier.

func Newv

func Newv(msg string, values map[string]interface{}) error

Newv returns a new error with the callstack that formats as the given text and associates the supplied data with the error.

func ResetStack

func ResetStack(err error) error

ResetStack generates a new stack trace for the error at the current location if one was present. This is useful when the original stack trace is too generic to be useful, such as a generic goroutine handling communication processing and relaying errors back to the original caller. Every error would have the generic goroutine stack trace when wrapped. Allowing the stack to be recaptured at the point where the error arrives back at the original caller provides much more useful information.

func Wrap

func Wrap(err error, msg ...string) error

Wrap wraps an error, creating a callstack if necessary and prefixing the underlying error message with the optional given text.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Wrapf wraps an error, creating a callstack if necessary and prefixing the underlying error message with the given text formatted with the specifier.

func Wrapv

func Wrapv(err error, values map[string]interface{}, msg ...string) error

Wrapv wraps an error, creating a callstack if necessary and associating the supplied data with the error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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