Documentation
¶
Overview ¶
Package errfmt defines the stable exit codes and typed errors shared by every store CLI built on vtexkit.
The codes are a published contract: agents and scripts branch on them, so a number may never change meaning across releases. Codes 7 and 8 are the only transient ones — everything else means fail fast.
Index ¶
- Constants
- type Error
- func Auth(msg string) *Error
- func Config(msg string) *Error
- func Domain(msg string) *Error
- func Empty() *Error
- func Forbidden(msg string) *Error
- func New(code int, msg string) *Error
- func NotFound(msg string) *Error
- func RateLimit() *Error
- func Retryable(msg string) *Error
- func Usage(msg string) *Error
- func Wrap(code int, msg string, err error) *Error
- type ExitCodeEntry
Constants ¶
View Source
const ( ExitOK = 0 ExitError = 1 ExitUsage = 2 ExitEmpty = 3 ExitAuth = 4 ExitNotFound = 5 ExitForbidden = 6 ExitRateLimit = 7 ExitRetryable = 8 // ExitDomain reports that a store business rule refused the operation. // zonasul v0.5.0 published this code as "cart below R$100 minimum"; // the number is preserved but the meaning is generalized, because a // minimum order is meaningless for a store that has none. ExitDomain = 9 ExitConfig = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Detail string `json:"detail,omitempty"`
}
type ExitCodeEntry ¶
type ExitCodeEntry struct {
Code int `json:"code"`
Name string `json:"name"`
Description string `json:"description"`
Transient bool `json:"transient"`
}
func ExitCodeTable ¶
func ExitCodeTable() []ExitCodeEntry
ExitCodeTable is the machine-readable exit code reference, exposed by every CLI as `<store> exit-codes --json`. Entries are index-aligned to their codes.
Click to show internal directories.
Click to hide internal directories.