stackerr

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2015 License: MIT Imports: 3 Imported by: 0

README

Documentation

Overview

Package stackerr provides a way to augment errors with one or more stack traces to allow for easier debugging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(s string) error

New returns a new error that includes the Stack.

func Newf

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

Newf formats and returns a new error that includes the Stack.

func Underlying

func Underlying(e error) []error

Underlying returns all the underlying errors by iteratively checking if the error has an Underlying error. If e is nil, the returned slice will be nil.

func Wrap

func Wrap(err error) error

Wrap provides a convenience function that calls WrapSkip with skip=0. That is, the Stack starts with the caller of Wrap.

func WrapSkip

func WrapSkip(err error, skip int) error

WrapSkip the error and add the current Stack. The argument skip is the number of stack frames to ascend, with 0 identifying the caller of Wrap. If the error to be wrapped has a MultiStack, the current stack will be added to it. If the error to be wrapped is nil, a nil error is returned.

Types

type Error

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

Error provides the wrapper that adds multiple Stacks to an error. Each Stack represents a location in code thru which this error was wrapped.

func (*Error) Error

func (e *Error) Error() string

Error provides a multi line error string that includes the stack trace.

func (*Error) MultiStack

func (e *Error) MultiStack() *stack.Multi

MultiStack identifies the locations this error was wrapped at.

func (*Error) Underlying

func (e *Error) Underlying() error

Underlying returns the error that is being wrapped.

Jump to

Keyboard shortcuts

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