Documentation
¶
Overview ¶
Package output holds the JSON envelope and the stable error/exit-code contract.
Index ¶
- Constants
- func Failure(w io.Writer, err error) int
- func Success(w io.Writer, data any) error
- type Error
- func Ambiguous(format string, a ...any) *Error
- func As(err error) *Error
- func Auth(format string, a ...any) *Error
- func FloodWait(seconds int) *Error
- func Internal(format string, a ...any) *Error
- func LockBusy(format string, a ...any) *Error
- func NotFound(format string, a ...any) *Error
- func ReadOnly(format string, a ...any) *Error
- func Telegram(format string, a ...any) *Error
- func Usage(format string, a ...any) *Error
- func WatcherRefused(format string, a ...any) *Error
Constants ¶
View Source
const ( ExitOK = 0 ExitInternal = 1 ExitUsage = 2 ExitAuth = 3 // not logged in, or blocked by read-only mode ExitNotFound = 4 // not found or ambiguous ExitRPC = 5 // Telegram RPC error or flood wait ExitLockBusy = 6 ExitWatcher = 7 // watcher refused to send )
Exit codes.
View Source
const ( CodeUsage = "usage" CodeAuth = "auth" CodeReadOnly = "readonly" CodeNotFound = "not_found" CodeAmbiguous = "ambiguous" CodeTelegram = "telegram" CodeFloodWait = "flood_wait" CodeLockBusy = "lock_busy" CodeWatcherRefused = "watcher_refused" CodeInternal = "internal" )
Error codes (the "code" field of the error object).
View Source
const SchemaVersion = "1"
SchemaVersion is bumped on breaking changes to the JSON shapes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.