← Back to issue list

ArgumentParsingError for command not found should hint at the command that raised it

View original Github issue

Metadata

Project
craft-cli
Number
#78
Type
issue
State
open
Author
sergiusens
Labels
—
Created
Updated
Closed
—

Current evaluation

Feature request: ArgumentParsingError carries no attribute naming the offending command, forcing downstream apps to dig into err.__context__ to distinguish unknown-command errors. Still unimplemented at HEAD.

Suggested action: needs triage

Reason: The class at craft_cli/errors.py is still a bare `class ArgumentParsingError(Exception):` with no fields, and Dispatcher.pre_parse_args still raises it with only a message string (including the unknown-command path `raise ArgumentParsingError(help_text) from None`), so the request remains open-ended and valid. However the issue carries no labels, no assignee and no comments, and the body only sketches a workaround (`err.__context__.args[0]`) rather than specifying an API (attribute name, whether it applies to all five raise sites in dispatcher.py, backward-compat with existing `except ArgumentParsingError` handlers), so it still needs maintainer prioritization.

Evaluated by: mr-cal-bot

Impact: 28 Quick Win: 12 Complexity: 18 Confidence: 72 Actionability: 52

Issue body

If the error class had an attribute with the command that raised it we could do more advanced error handling. Right now I am looking into doing it this way: ```python try: cmd.run(...) except ArgumentParsingError as err: if err.__context__.args[0] not in dispatcher.commands.keys(): do_something() else: raise ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 28
Quick Win: 12
Complexity: 18
Confidence: 72
Actionability: 52
needs triage Feature request: ArgumentParsingError carries no attribute naming the offending command, forcing downstream apps to dig into err.__context__ to distinguish unknown-command errors. Still unimplemented at HEAD.
stealth/space-bunny-alpha
Impact: 38
Quick Win: 20
Complexity: 22
Confidence: 80
Actionability: 68
keep open Maintainer-filed feature request to add a command attribute to the bare ArgumentParsingError class so callers can detect 'no such command' without parsing __context__.args; class still has no attributes at HEAD.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 19
Complexity: 20
Confidence: 70
Actionability: 80
needs triage Feature request to add a command attribute to ArgumentParsingError for better error handling
qwen/qwen3.8-27b
Impact: 25
Quick Win: 21
Staleness: 72
Complexity: 15
Confidence: 85
Support Request: 10
needs triage Feature request to add the offending command name as an attribute on ArgumentParsingError raised for unknown commands, enabling programmatic error handling. Still unimplemented in current code.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 15
Confidence: 85
Support Request: 5
close stale Request to add a command attribute to ArgumentParsingError for improved error handling. The issue is unlabelled, has zero maintainer comments, and has been inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 15
Confidence: 75
Support Request: 5
needs triage Feature request to add a command attribute to ArgumentParsingError for improved error handling. Unlabelled, zero comments, and inactive for over a year.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.