mbcollection: handle MB Unauthorized error#6661
Open
snejus wants to merge 2 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6661 +/- ##
==========================================
+ Coverage 72.46% 72.48% +0.01%
==========================================
Files 161 161
Lines 20719 20731 +12
Branches 3280 3280
==========================================
+ Hits 15014 15026 +12
Misses 4979 4979
Partials 726 726
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
grug see PR make mbcollection not crash when MusicBrainz say 401 Unauthorized. grug like: plugin now catch nice beets HTTP error, log clear hint for user config, then keep program alive.
Changes:
- add MusicBrainz-specific
UnauthorizedMBErrorand register it inMusicBrainzAPIHTTP error mapping - catch
BeetsHTTPErrorinmbcollectionsync flow and log friendly error instead of raising up to importer - add regression test and changelog note for 401 behavior
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
beetsplug/_utils/requests.py |
allow BeetsHTTPError to accept custom message so domain errors can give better text |
beetsplug/_utils/musicbrainz.py |
define UnauthorizedMBError (401) and register in MusicBrainz API handler |
beetsplug/mbcollection.py |
catch BeetsHTTPError during collection update and log error instead of crash |
test/plugins/test_mbcollection.py |
add test that mbupdate logs unauthorized failure |
docs/changelog.rst |
document bugfix for mbcollection unauthorized case |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Summary
This change makes
mbupdatefail gracefully when MusicBrainz returns401 Unauthorized.High-level impact
UnauthorizedMBError, on top of the sharedBeetsHTTPErrorrequest layer.MusicBrainzAPI, so authentication failures are translated into a clearer domain-specific exception.beetsplug/mbcollection.pyto catchBeetsHTTPErrorduring collection sync and log a user-friendly error instead of crashing.docs/changelog.rst.Architectural effect
beetsplug/_utils/musicbrainz.pyandbeetsplug/_utils/requests.py.mbcollectionfocused on sync flow and error handling, rather than raw HTTP details.mbcollectionplugin without changing the normal successful update path.Fixes #6651