errors

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const ExitHandlerPanicMessage = "At least one exit handler vetoed to exit program execution"

Variables

This section is empty.

Functions

func ClearExitHandler

func ClearExitHandler()

ClearExitHandler clears all registered exit handlers

func Exit

func Exit(code int)

Exit runs all registered exit handlers and then exits the program with the specified exit code using os.Exit.

func ExitWithMessage

func ExitWithMessage(code int, text string, args ...interface{})

ExitWithMessage runs all registered exit handlers, prints the specified message and then exits the program with the specified exit code. If the exit code is 0, the message is prints to stdout, otherwise to stderr.

func New

func New(text string) error

func Newf

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

func RegisterExitHandler

func RegisterExitHandler(exitHandler exitHandlerFunc)

Register registers an exit handler function which is run when Exit is called

func RetryAfter

func RetryAfter(attempts int, callback func() error, d time.Duration) (err error)

RetryAfter retries a number of attempts, after a delay

Types

type MultiError

type MultiError struct {
	Errors []error
}

func (*MultiError) Collect

func (m *MultiError) Collect(err error)

func (MultiError) ToError

func (m MultiError) ToError() error

type RetriableError

type RetriableError struct {
	Err error
}

RetriableError is an error that can be tried again

func (RetriableError) Error

func (r RetriableError) Error() string

Jump to

Keyboard shortcuts

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