mirror of https://github.com/ppy/osu
Add fallback to use `Message` when `Hint` is not available
This commit is contained in:
parent
266b4c7124
commit
3a0b7ba8ff
|
@ -62,7 +62,7 @@ internal void AuthenticateWithLogin(string username, string password)
|
|||
// attempt to decode a displayable error string.
|
||||
var error = JsonConvert.DeserializeObject<OAuthError>(req.GetResponseString() ?? string.Empty);
|
||||
if (error != null)
|
||||
throwableException = new APIException(error.Message, ex);
|
||||
throwableException = new APIException(error.UserDisplayableError, ex);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -201,10 +201,15 @@ protected override void PrePerform()
|
|||
|
||||
private class OAuthError
|
||||
{
|
||||
public string UserDisplayableError => !string.IsNullOrEmpty(Hint) ? Hint : ErrorIdentifier;
|
||||
|
||||
[JsonProperty("error")]
|
||||
public string ErrorType { get; set; }
|
||||
public string ErrorIdentifier { get; set; }
|
||||
|
||||
[JsonProperty("hint")]
|
||||
public string Hint { get; set; }
|
||||
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue