errors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

Cause returns the underlying cause of the error, if possible. An error value has a cause if it implements the Causer interface. If the error does not implement Causer, the original error will be returned. If the error is nil, nil will be returned.

func Location

func Location(err error) (file string, line int)

Location returns the location of the error, if known. An error value has a location if it implements the StackTracer interface.

func StackTrace

func StackTrace(err error) errors.StackTrace

StackTrace returns the stack trace associated with the error, if known. An error value has an associated stack trace if it implements the StackTracer interface.

Types

type Causer

type Causer interface {
	Cause() error // Cause returns the underlying cause of the error, if possible.
}

Causer is the interface satisfied by an error with a Cause method.

type StackTracer

type StackTracer interface {
	StackTrace() errors.StackTrace // StackTrace returns the associated stack trace.
}

StackTracer is the interface satisfied by an error with a StackTrace method.

type Template

type Template string

Template provides a template error.

func (Template) Is

func (p Template) Is(e error) bool

Is returns true iff the given error e was created from the template p.

func (Template) New

func (p Template) New(args ...interface{}) error

New returns an error from the template. The returned error satisfied the Locationer, StackTracer, and Templater interfaces

func (Template) String

func (p Template) String() string

String returns the text defining this template.

type Templater

type Templater interface {
	Template() Template // Template returns the associated template.
}

Templater is the interface satisfied by an object with a Template method.

Jump to

Keyboard shortcuts

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