errors: github.com/golangplus/errors Index | Files

package errorsp

import "github.com/golangplus/errors"

Index

Package Files

errors.go

Variables

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
)

func Cause Uses

func Cause(err error) error

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

func NewWithStacks Uses

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

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

func WithStacks Uses

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 Uses

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.

type ErrorWithStacks Uses

type ErrorWithStacks struct {
    Err    error
    Stacks []string
}

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

func (*ErrorWithStacks) Error Uses

func (e *ErrorWithStacks) Error() string

Error implements the error interface.

Package errorsp imports 6 packages (graph) and is imported by 18 packages. Updated 2018-09-24. Refresh now. Tools for package owners.