Fix some add-on installation errors not being reported #2518
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A missing future.result() call was masking add-on install/update errors. You can reproduce the issue by installing my add-on InContext, then manually decreasing meta.json's
mod
value and checking for add-on updates to trigger an update. You should see that the download progress dialog closes silently with Anki showing the "No updates available." tooltip. Anki then will prompt to update the same add-on every time.In the case of InContext, a PermissionError was being masked, which is caused by the add-on holding a DB connection to a file in the user_files folder indefinitely, preventing Anki from backing up the folder (only a problem on Windows AFAIK).
I guess the issue in my add-on can be solved by either (1) refactoring the add-on to hold a DB connection only when absolutely needed, (2) patching some methods or (3) making use of hooks to close the connection when the add-on is being deleted/updated. I prefer (3) but the
addons_dialog_will_delete_addons
hook for example is not called when updating. Will you accept a PR that adds a call to it in the update routine, or maybe adds a new hook?