errorsp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: BSD-3-Clause Imports: 6 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// The maximum depth in ErrorWithStacks.Stacks.
	// The last line is set to "..." if some call stacks are ignored.
	// Only set this if some very deep callstack can happen, e.g. deep recursive calling.
	MaxStackDepth int = math.MaxInt32
)

Functions

func Cause

func Cause(err error) error

Returns the root cause of the error. Will not return a *ErrorWithStacks.

func NewWithStacks

func NewWithStacks(format string, a ...interface{}) error

WithStacks returns a *ErrorWithStacks error with the message and stacks set.

func WithStacks

func WithStacks(err error) error

WithStacks returns a *ErrorWithStacks error with stacks set. If err is nil, a nil is returned. If err has been a *ErrorWithStacks, it is directly returned.

func WithStacksAndMessage

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

WithStacksAndMessage returns a *ErrorWithStacks error with stacks and message set. If err is nil, a nil is returned. If err has been a *ErrorWithStacks, the corresponding call stack line is appended with the message.

Types

type ErrorWithStacks

type ErrorWithStacks struct {
	Err    error
	Stacks []string
}

ErrorWithStacks is a struct containing the original error and the call stacks.

func (*ErrorWithStacks) Error

func (e *ErrorWithStacks) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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