beets
beets copied to clipboard
plugins: ensure to log the offending plugin on instantiation failure
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.)
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.
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.
This should be ready to go now; it's easiest to review commit-by-commit.
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).