Description
openedon Mar 9, 2021
What is the idea?
We here at conda-forge use some of the conda build APIs for our work. The code has been getting an increasing number of sys.exit
calls for errors, which are causing our jobs to die.
Instead, maybe the code should raise an error and then catch it at the highest level and call sys.exit? This preserves the internals for others while maintaining the same behavior.
Why is this needed?
sys.exit
calls are harder to catch/debug when using conda_build as an API.
What should happen?
Review and ideally remove all sys.exit
calls.
Additional Context
These sys.exit calls in conda-build are very painful for downstream users of the code base as a library (i.e., conda-forge). The reason is that in the python exception hierarchy has the
SystemExit
exception raised bysys.exit
and the standardException
at the same level (https://docs.python.org/3/library/exceptions.html#exception-hierarchy). This means when one callssys.exit
, the invoking code cannot catch that exception without resorting to explicitly catchingSystemExit
as opposed to a normalException
. The slight change in exception handling API breaks (at least my) expectations as a user of the code and has created quite a few mystery code crashes in the bot over the years.Can we use a standard exception here and then have the conda-build CLI code handle that exception and call
sys.exit
?
Originally posted by @beckermr in #5237 (comment)
Metadata
Assignees
Labels
Type
Projects
Status
🏗️ In Progress