Plugin system: improve error handling #13741
Labels
plugins
pertains to a plugin/subcommand
source::contributor
created by a frequent contributor
tag::ux
related to user experience
type::feature
request for a new feature or capability
Checklist
What is the idea?
Add a new configuration option for subcommand plugins:
@conda.plugins.hookimpl def conda_subcommands(): yield conda.plugins.CondaSubcommand( name="build", summary="Build conda packages from a conda recipe.", action=build, + base_exception_class=CondaBuildError, )
This is then exposed by the plugin manager to conda's exception handling logic to consider them "expected exceptions" instead of unexpected. The kwarg name can also be
expected_exception_type
and so on.Why is this needed?
Subcommands plugins will run their code under conda's exception handler. If the exceptions raised are not covered by this logic:
conda/conda/exception_handler.py
Lines 49 to 75 in bfc82e1
Then conda will create an error report with added verbosity.
This is creating UX issues in conda-build, where it is normal to raise CalledProcessError for a failed build script. See conda/conda-build#5263.
What should happen?
If a subcommand plugin registers an expected exception type, then conda will not create an error report. The full traceback will be available in
--debug
and-vvv
modes, as usual.Some documentation on how to use this feature should be added too.
Additional Context
Comes from conda/conda-build#5263. For this to benefit conda-build, conda-build will also need to change the types of their expected exceptions.
The text was updated successfully, but these errors were encountered: