errors

package
v0.0.0-...-2f10389 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package errors provides an api similar to github.com/nuclio/nuclio/pkg/errors

Index

Constants

This section is empty.

Variables

View Source
var (
	// ShowLineInfo sets if we collect location information (file, line)
	// (getting location information makes creating error slower ~550ns vs 2ns)
	ShowLineInfo bool
)

Functions

func Cause

func Cause(err error) error

Cause is the cause of the error

func Errorf

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

Errorf returns a new Error

func GetErrorStack

func GetErrorStack(err error, depth int) []error

GetErrorStack return stack of messges (oldest on top) if n == -1 returns the whole stack

func New

func New(message string) error

New returns a new error

func PrintErrorStack

func PrintErrorStack(out io.Writer, err error, depth int)

PrintErrorStack prints the error stack into out upto depth levels If n == 1 then prints the whole stack

func Wrap

func Wrap(err error, message string) error

Wrap returns a new error with err as cause, if err is nil will return nil

func Wrapf

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

Wrapf returns a new error with err as cause, if err is nil will return nil

Types

type Error

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

Error implements error interface with call stack

func (*Error) Error

func (err *Error) Error() string

Error is the string representation of the error

func (*Error) Format

func (err *Error) Format(s fmt.State, verb rune)

Format formats an error

func (*Error) LineInfo

func (err *Error) LineInfo() (string, int)

LineInfo info returns the location (file, line) where the error was created

Jump to

Keyboard shortcuts

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