Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrWriter io.Writer = os.Stderr
ErrWriter is used to write errors to the user. This can be anything implementing the io.Writer interface and defaults to os.Stderr.
View Source
var OsExiter = os.Exit
OsExiter is the function used when the app exits. If not set defaults to os.Exit.
Functions ¶
func HandleExitCoder ¶
func HandleExitCoder(err error)
HandleExitCoder checks if the error fulfills the ExitCoder interface, and if so prints the error to stderr (if it is non-empty) and calls OsExiter with the given exit code. If the given error is a MultiError, then this func is called on all members of the Errors slice and calls OsExiter with the last exit code.
Types ¶
type ErrorFormatter ¶
type ExitError ¶
type ExitError struct {
// contains filtered or unexported fields
}
ExitError fulfills both the builtin `error` interface and `ExitCoder`
func NewExitError ¶
NewExitError makes a new *ExitError
Click to show internal directories.
Click to hide internal directories.