exitcode

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package exitcode maps SDK errors onto the CLI's exit codes and friendly messages, so scripts can branch on the class of failure.

Index

Constants

View Source
const (
	OK          = 0
	Err         = 1 // any other error
	Usage       = 2 // bad invocation or missing configuration
	Auth        = 3 // unauthorized / forbidden
	Payment     = 4 // free tier hitting the paid-only API
	NotFound    = 5
	Unsupported = 6 // capability missing on this backend
	Throttled   = 7 // rate-limited or upstream timeout after retries
)

Exit codes. 0 is success.

Variables

This section is empty.

Functions

func Classify

func Classify(err error) (int, string)

Classify returns the exit code and the message to print for err.

func Usagef

func Usagef(format string, a ...any) error

Usagef builds a UsageError.

Types

type UsageError

type UsageError struct{ Msg string }

UsageError marks an invocation error (exit code 2).

func (*UsageError) Error

func (e *UsageError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL