canonical / canonical/craft-cli

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

Open
#78 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
16
Forks
27
Avg merge
2d 1h
Merged PRs (30d)
12

Description

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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.