Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display clear error message when MusicBrainz is unreachable #1272

Merged
merged 2 commits into from
Jan 28, 2015
Merged

Display clear error message when MusicBrainz is unreachable #1272

merged 2 commits into from
Jan 28, 2015

Conversation

tomjaspers
Copy link
Contributor

E.g.: Error: MusicBrainz not reachable in get release by ID with query etc etc ...

Catch musicbrainzngs.WebServiceError before the general musicbrainzngs.MusicBrainzError
Fix #1190

…ainz not reachable"

Catch musicbrainzngs.WebServiceError before the general musicbrainzngs.MusicBrainzError
Fix #1190
@sampsyo
Copy link
Member

sampsyo commented Jan 26, 2015

Great; thanks for getting to the bottom of this.

Can I suggest a slightly different fix that requires less duplicated code? Inside MusicBrainzAPIError.__init__, let's just do something like:

if isinstance(reason, musicbrainzngs.WebServiceError):
    reason = 'MusicBrainz not reachable'

That is, we can centralize this check and string literal in one place if we move it to the exception constructor.

@tomjaspers
Copy link
Contributor Author

@sampsyo Good suggestion; I knew there had to be a better solution.

@sampsyo sampsyo merged commit e7f3987 into beetbox:master Jan 28, 2015
sampsyo added a commit that referenced this pull request Jan 28, 2015
Display clear error message when MusicBrainz is unreachable
sampsyo added a commit that referenced this pull request Jan 28, 2015
@sampsyo
Copy link
Member

sampsyo commented Jan 28, 2015

Merged! Thanks for taking care of this. ✨ That's two contributions in one week for you! A double thank-you is in order. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error message when MusicBrainz is unreachable
2 participants