Documentation
¶
Index ¶
- func As(err error, target interface{}) bool
- func FormatError(err error, includeStack bool) string
- func Is(err, target error) bool
- func Wrap(err error, message string) error
- func Wrapf(err error, format string, args ...interface{}) error
- type CLIError
- func NewAuthError(technicalErr error, userMsg string) *CLIError
- func NewCLIError(technicalErr error, userMsg string, exitCode ExitCode) *CLIError
- func NewError(technicalErr error, userMsg string) *CLIError
- func NewNetworkError(technicalErr error, userMsg string) *CLIError
- func NewUsageError(userMsg string) *CLIError
- type ExitCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatError ¶
FormatError formats an error for display, optionally including stack trace
Types ¶
type CLIError ¶
type CLIError struct {
// TechnicalError is the underlying technical error (for logging)
TechnicalError error
// UserMsg is the user-friendly error message
UserMsg string
// ExitCode is the exit code to return
ExitCode ExitCode
// StackTrace contains the call stack when debug mode is enabled
StackTrace string
}
CLIError represents a CLI error with user-friendly message and exit code
func NewAuthError ¶
NewAuthError creates a CLIError for authentication failures
func NewCLIError ¶
NewCLIError creates a new CLIError
func NewNetworkError ¶
NewNetworkError creates a CLIError for network failures
func NewUsageError ¶
NewUsageError creates a CLIError with ExitUsageError code
func (*CLIError) WithStackTrace ¶
WithStackTrace adds a stack trace to the error
type ExitCode ¶
type ExitCode int
ExitCode represents CLI exit codes
const ( // ExitSuccess indicates successful execution ExitSuccess ExitCode = 0 // ExitError indicates a general error ExitError ExitCode = 1 // ExitUsageError indicates invalid command usage ExitUsageError ExitCode = 2 // ExitAuthError indicates an authentication error ExitAuthError ExitCode = 3 // ExitNetworkError indicates a network error ExitNetworkError ExitCode = 4 )
Click to show internal directories.
Click to hide internal directories.