exitcodes

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 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

	// ExitCodeTestFailed indicates a test case had failed.
	ExitCodeTestFailed = 7
)

Variables

This section is empty.

Functions

func GetErrorExitCode

func GetErrorExitCode(err error) int

GetErrorExitCode 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 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