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

CreateWebserviceException() fix when 503 BadGataway status code received #71

Merged
merged 1 commit into from
May 13, 2024

Conversation

windracer
Copy link
Contributor

@windracer windracer commented May 13, 2024

If the website is down for maintenance, it returns the 503 error code and the following page causing MusicBrainzClient to throw the System.Runtime.Serialization.SerializationException exception with the following message instead of WebServiceException:

There was an error deserializing the object of type Hqub.MusicBrainz.MusicBrainzClient+ResponseError. Encountered unexpected character '<'.

The fix catches any exception that may occur during deserialization and throws the WebServiceException exception instead with the status code as a message.

This is the 503 response page from MusicBrainz:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
  <head>
    <title>503 Service Unavailable</title>
    <link rel="stylesheet" href="/.custom_error_pages/httperror.css" type="text/css" />
  </head>
  <body>
    <div id="bg">
      <img src="/.custom_error_pages/MusicBrainzLogo-Z.png" />
    </div>
    <h1>Server Maintenance</h1>
    <p>This site is down for maintenance.&nbsp; Please try again later.</p>
    <p id="http">503 Service Unavailable</p>
  </body>
</html>

@wo80
Copy link
Collaborator

wo80 commented May 13, 2024

Good catch and straight forward fix! Thank you! I will publish a patch release on Nuget in the next days.

@wo80 wo80 merged commit 58c03a0 into avatar29A:master May 13, 2024
1 check passed
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.

2 participants