Documentation
¶
Index ¶
- Constants
- func ClearExitHandler()
- func Exit(code int)
- func ExitWithMessage(code int, text string, args ...interface{})
- func New(text string) error
- func Newf(format string, args ...interface{}) error
- func RegisterExitHandler(exitHandler exitHandlerFunc)
- func RetryAfter(attempts int, callback func() error, d time.Duration) (err error)
- type MultiError
- type RetriableError
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 ¶
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 RegisterExitHandler ¶
func RegisterExitHandler(exitHandler exitHandlerFunc)
Register registers an exit handler function which is run when Exit is called
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
Click to show internal directories.
Click to hide internal directories.