Safer handling of the initial installation of add-ons (#16851)
Fixes #16704
Fixup of #15967
Summary of the issue:
In the following code block:
release-2024.2/source/addonHandler/__init__.py#L432-L454
If an error is raised from running addon.runInstallTask("onInstall"), it is caught, and then re-raised as AddonError
However, this exception is caught again by the finally statement returning the add-on
returning from finally suppresses the exception. This means the callers don't correctly handle the expected exception, as it is suppressed, where it should instead prevent the installation from continuing.
We have to return the add-on to perform clean up tasks, but we have to know exceptions were raised to cancel the add-on installation
Description of user facing changes
Add-on installation failures should fail gracefully
Description of development approach
Instead of raising exceptions, store them and exit the installation process when a failure occurs.
If exceptions are stored, cancel the installation and perform the require clean-up tasks