Documentation
¶
Overview ¶
Package errs defines exit-code-aware typed errors for the CLI.
Commands return *Error values; cmd.Execute() inspects the code and exits with the matching numeric exit code per the mp2rss CLI contract:
0 success | 1 generic | 2 args | 3 auth | 4 not found | 5 upstream unavailable
Index ¶
Constants ¶
View Source
const ( CodeOK = 0 CodeGeneric = 1 CodeArgs = 2 CodeAuth = 3 CodeNotFound = 4 CodeUpstreamDown = 5 )
Exit codes per the CLI contract.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Code int // exit code
HTTPStatus int // upstream HTTP status if any
Message string // user-facing message
Cause error // wrapped underlying error (for `errors.Is/As`)
}
Error is a CLI-visible error with both a human message and an exit code.
HTTPStatus is the upstream HTTP status code when the error originated from an API response. It is 0 for purely local errors.
Click to show internal directories.
Click to hide internal directories.