Documentation ¶
Index ¶
Constants ¶
const ( ExitCodeSuccess int = iota ExitCodeError )
The codes are returned by the application after completion
Variables ¶
This section is empty.
Functions ¶
func CheckErrorAndExit ¶
func CheckErrorAndExit(err error)
CheckErrorAndExit checks if there is an error, display it in the console and exit with a non-zero exit code. Otherwise, exit 0. Note that if the debugMode is true, this will print out the stack trace.
func ErrorStack ¶
ErrorStack converts the given error to a string, including the stack trace if available
func ExitCode ¶
ExitCode returns the exit code of a command. If the error contains no exit codes, a success code is returned.
func IsContextCanceled ¶
IsContextCanceled returns `true` if error has occurred by event `context.Canceled` which is not really an error
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a custom error
func Errorf ¶
Errorf creates a new error with the given message. You can use it as a drop-in replacement for fmt.Errorf() to provide descriptive errors in return values.
func New ¶
func New(err interface{}) *Error
New makes an Error from the given value. If that value is already an error then it will be used directly, if not, it will be passed to fmt.Errorf("%v"). The stacktrace will point to the line of code that called New.
func (*Error) ErrorStack ¶
ErrorStack returns a string that contains both the error message and the callstack.