Documentation
¶
Overview ¶
Package errors provides structured CLI error types for Mush.
CLIError wraps errors with user-facing messages, hints, and exit codes to provide consistent, actionable error output across all commands.
Index ¶
- Constants
- func As(err error, target **CLIError) bool
- type CLIError
- func APIKeyEmpty() *CLIError
- func AuthFailed(cause error) *CLIError
- func CannotPrompt(envVar string) *CLIError
- func ClaudeExecutionFailed(exitCode int, stderr string) *CLIError
- func ClaudeNotFound() *CLIError
- func ClaudeSignalKilled() *CLIError
- func ConfigFailed(operation string, cause error) *CLIError
- func CredentialsInvalid(cause error) *CLIError
- func ExecutionTimedOut(timeout string, lastTools []string) *CLIError
- func HabitatNotFound(name string) *CLIError
- func HabitatRequired() *CLIError
- func InvalidAgentType(agentType string) *CLIError
- func JobNotFound(jobID string) *CLIError
- func LinkRegistrationFailed(cause error) *CLIError
- func New(code int, message string) *CLIError
- func NoHabitats() *CLIError
- func NoInstructionsForQueue(queueName, queueSlug string) *CLIError
- func NoQueuesForHabitat() *CLIError
- func NotAuthenticated() *CLIError
- func QueueNotFound(name string) *CLIError
- func QueueRequired() *CLIError
- func Wrap(code int, message string, cause error) *CLIError
Constants ¶
const ( ExitSuccess = 0 // Successful execution ExitGeneral = 1 // General error ExitAuth = 2 // Authentication error ExitNetwork = 3 // Network/API error ExitConfig = 4 // Configuration error ExitTimeout = 5 // Execution timeout ExitExecution = 6 // Execution failure ExitUsage = 64 // Command line usage error (BSD convention) )
Exit codes for CLI errors.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CLIError ¶
type CLIError struct {
// Message is the primary error message shown to the user.
Message string
// Hint provides actionable guidance on how to fix the error.
Hint string
// Cause is the underlying error, if any.
Cause error
// Code is the exit code for the CLI.
Code int
}
CLIError represents a user-facing CLI error with actionable guidance.
func APIKeyEmpty ¶
func APIKeyEmpty() *CLIError
APIKeyEmpty returns an error when the API key is empty.
func AuthFailed ¶
AuthFailed returns an error for failed authentication.
func CannotPrompt ¶
CannotPrompt returns an error when interactive prompts are unavailable.
func ClaudeExecutionFailed ¶
ClaudeExecutionFailed returns an error for Claude execution failures. It detects common error patterns and provides specific hints.
func ClaudeNotFound ¶
func ClaudeNotFound() *CLIError
ClaudeNotFound returns an error when Claude CLI is not available.
func ClaudeSignalKilled ¶
func ClaudeSignalKilled() *CLIError
ClaudeSignalKilled returns an error for interrupted execution.
func ConfigFailed ¶
ConfigFailed returns an error for configuration save failures.
func CredentialsInvalid ¶
CredentialsInvalid returns an error for invalid stored credentials.
func ExecutionTimedOut ¶
ExecutionTimedOut returns an error for execution timeout with context.
func HabitatNotFound ¶
HabitatNotFound returns an error for an unknown habitat.
func HabitatRequired ¶
func HabitatRequired() *CLIError
HabitatRequired returns an error when a habitat is required but not specified.
func InvalidAgentType ¶
InvalidAgentType returns an error for an unsupported agent type.
func JobNotFound ¶
JobNotFound returns an error for an unknown job.
func LinkRegistrationFailed ¶
LinkRegistrationFailed returns an error when link registration fails.
func NoHabitats ¶
func NoHabitats() *CLIError
NoHabitats returns an error when no habitats exist in the workspace.
func NoInstructionsForQueue ¶
NoInstructionsForQueue returns an error when no active instruction exists for a queue.
func NoQueuesForHabitat ¶
func NoQueuesForHabitat() *CLIError
NoQueuesForHabitat returns an error when a habitat has no eligible queues.
func NotAuthenticated ¶
func NotAuthenticated() *CLIError
NotAuthenticated returns an error indicating missing credentials.
func QueueNotFound ¶
QueueNotFound returns an error for an unknown queue.
func QueueRequired ¶
func QueueRequired() *CLIError
QueueRequired returns an error when a queue is required but not specified.