diff options
Diffstat (limited to 'internal/exitcodes/exitcodes.go')
-rw-r--r-- | internal/exitcodes/exitcodes.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/exitcodes/exitcodes.go b/internal/exitcodes/exitcodes.go index 908e714..ae00118 100644 --- a/internal/exitcodes/exitcodes.go +++ b/internal/exitcodes/exitcodes.go @@ -10,12 +10,13 @@ import ( const ( // Other error - please inspect the message Other = 11 - // The password was incorrect + // PasswordIncorrect - the password was incorrect PasswordIncorrect = 12 // TODO several other exit codes are defined in main.go. These will be // ported over here. ) +// Err wraps and error with an associated numeric exit code type Err struct { error code int @@ -29,6 +30,8 @@ func NewErr(msg string, code int) Err { } } +// Exit extracts the numeric exit code from "err" (if available) and exits the +// application. func Exit(err error) { err2, ok := err.(Err) if !ok { |