Documentation
¶
Overview ¶
Package code provides types and functions for handling process exit codes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotParsable is returned when an exit code cannot be parsed. ErrNotParsable = errors.New("exit code is not parsable") // ErrUnsupportedType is returned when an unsupported type is provided for exit code parsing. ErrUnsupportedType = errors.New("unsupported type for exit code") )
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code uint8
Code represents the exit code of a process.
const ( // Success indicates that the process completed successfully. // // This exit code is commonly used to indicate that a program has // executed without any errors. Success Code = 0 // Failure indicates that the process failed. // // This exit code is commonly used to indicate a general error or failure // that does not fall under more specific categories. Failure Code = 1 )
func ParseCode ¶
ParseCode parses the provided code value and returns it.
The code parameter can be of type uint8, int, or string. It converts the provided value to a Code type accordingly.
If the conversion fails, it returns an error and Failure code.
Click to show internal directories.
Click to hide internal directories.