errors

package
v0.0.0-...-0f323ce Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

CheckErr calls ExitWithMessage when there is an error

func ExitWithMessage

func ExitWithMessage(message string)

ExitWithMessage print and write the stacktrace on the logs

func FindCause

func FindCause(err error) (code int, reason string, stack string)

FindCause finds the first error in the chain that has a status code assigned

func StatefulCause

func StatefulCause(err error) error

StatefulCause attempts to find the cause of the error that has a state associated, if it finds it returns it, otherwise returns the cause itself

Types

type StatefulErrorMessage

type StatefulErrorMessage struct {
	Code      int
	Message   string
	Format    string `default:"%d: %s"`
	Separator string `default:": "`
}

StatefulErrorMessage groups an error code with a message

func NewStatefulErrorMessage

func NewStatefulErrorMessage(code int, msg string) *StatefulErrorMessage

NewStatefulErrorMessage return a StatefulErrorMessage

func NewStatefulErrorMessageFromString

func NewStatefulErrorMessageFromString(str string) *StatefulErrorMessage

NewStatefulErrorMessageFromString create a StatefulErrorMessage from string

func (StatefulErrorMessage) String

func (s StatefulErrorMessage) String() string

String converts a stateful error message to string

Jump to

Keyboard shortcuts

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