errs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package errs provides typed errors with exit codes and user-facing hints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExitCode

func GetExitCode(err error) int

GetExitCode extracts the exit code from an error, defaulting to 1.

Types

type CLIError

type CLIError struct {
	Code    int
	Message string
	Hint    string
	Cause   error
}

CLIError is a structured error with an exit code and optional hint.

func AuthError

func AuthError(msg, hint string) *CLIError

func ConfigError

func ConfigError(msg, hint string) *CLIError

func General

func General(msg string) *CLIError

func Generalf

func Generalf(format string, args ...any) *CLIError

func NetworkError

func NetworkError(msg string, cause error) *CLIError

func PermissionError

func PermissionError(msg, hint string) *CLIError

func RateLimitError

func RateLimitError(msg, hint string) *CLIError

func RemoteAPIError

func RemoteAPIError(msg string, cause error) *CLIError

func UsageError

func UsageError(msg, hint string) *CLIError

func Wrap

func Wrap(code int, msg string, cause error) *CLIError

func (*CLIError) Error

func (e *CLIError) Error() string

func (*CLIError) ExitCode

func (e *CLIError) ExitCode() int

func (*CLIError) Format

func (e *CLIError) Format() string

Format returns the full user-facing error message with hint.

func (*CLIError) Unwrap

func (e *CLIError) Unwrap() error

Jump to

Keyboard shortcuts

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