canonical / craft-cli

https://canonical-craft-cli.readthedocs-hosted.com/en/latest/
GNU Lesser General Public License v3.0
9 stars 15 forks source link

fix(dispatcher): explicitly disable exception chaining #240

Closed lengau closed 7 months ago

lengau commented 7 months ago

In these cases, the chaining doesn't provide useful additional data.

Drive-by: updates ruff to 0.2

lengau commented 7 months ago

@mr-cal This does change the traceback, since it sets the __context__ to None rather than the previous exception. However, the context exceptions aren't useful to either an end user or a developer using this library since they're implementation details (they're mostly KeyError in places where we use dictionaries and in one case a StopIteration where we call next()). In all cases, these are raising ArgumentParsingError, which the application should always catch and display (but should never care about context).