exitcodes

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
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

func GetInnerErrorAndExitCode(err error) (error, int)

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.

Jump to

Keyboard shortcuts

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