beets icon indicating copy to clipboard operation
beets copied to clipboard

plugins: ensure to log the offending plugin on instantiation failure

Open wisp3rwind opened this issue 7 months ago • 3 comments

Came up in https://github.com/beetbox/beets/pull/5701#discussion_r2049220759 where an error can't easily be traced back to a plugin.

(Draft because I want to avoid creating merge conflicts for https://github.com/beetbox/beets/pull/5701 before that is merged, and because I might a few additional improvements here.)

wisp3rwind avatar Apr 17 '25 16:04 wisp3rwind

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

github-actions[bot] avatar Apr 17 '25 16:04 github-actions[bot]

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

github-actions[bot] avatar Apr 20 '25 09:04 github-actions[bot]

This should be ready to go now; it's easiest to review commit-by-commit.

wisp3rwind avatar Apr 20 '25 09:04 wisp3rwind

Should be good to go, but I'll rebase on https://github.com/beetbox/beets/pull/5841 once its merged.

Note that this isn't quite what the title says anymore: Logging wasn't as incomplete as I thought in the context of #5701. Thus, this PR only slightly improves logging, notably by fixing the "not found" error case (detection of which was quite hacky before, and in fact broken), and by logging the fully-qualified path to offending plugin classes.

Additionally, the PR refactors plugin loading, reducing nesting of the code, and actually instantiating plugins in load_plugins instead of find_plugins (which makes more sense conceptually, and the laziness in the former approach was irrelevant or even detrimental in practice).

wisp3rwind avatar Jun 27 '25 13:06 wisp3rwind

Do you feel like this was addressed? We had quite some related PRs recently.

We log the plugin name if it raises an error during import (see here). We also test if all plugins can be loaded without an error (see here).

semohr avatar Sep 30 '25 17:09 semohr