Documentation ¶
Index ¶
Constants ¶
const ( // ExitCodeSuccess indicates no errors or failures had occurred. ExitCodeSuccess = 0 // ExitCodeGeneralError indicates some type of general error occurred. ExitCodeGeneralError = 1 // ExitCodeHandledError indicates that there was an error that was logged already and does not need to be handled // by main. ExitCodeHandledError = 6 // ExitCodeTestFailed indicates a test case had failed. ExitCodeTestFailed = 7 )
Variables ¶
This section is empty.
Functions ¶
func GetInnerErrorAndExitCode ¶ added in v0.1.4
GetInnerErrorAndExitCode checks the given exit code that the application should exit with, if this error is bubbled to the top-level. This will be 0 for a nil error, 1 for a generic error, or arbitrary if the error is of type ErrorWithExitCode. Returns the error (or inner error if it is an ErrorWithExitCode error type), along with the exit code associated with the error.
Types ¶
type ErrorWithExitCode ¶
type ErrorWithExitCode struct {
// contains filtered or unexported fields
}
ErrorWithExitCode is an `error` type that wraps an existing error and exit code, providing exit codes for a given error if they are bubbled up to the top-level.
func NewErrorWithExitCode ¶
func NewErrorWithExitCode(err error, exitCode int) *ErrorWithExitCode
NewErrorWithExitCode creates a new error (ErrorWithExitCode) with the provided internal error and exit code.
func (*ErrorWithExitCode) Error ¶
func (e *ErrorWithExitCode) Error() string
Error returns the error message string, implementing the `error` interface.