mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Add fallback to use Message
when Hint
is not available
This commit is contained in:
@ -62,7 +62,7 @@ namespace osu.Game.Online.API
|
|||||||
// attempt to decode a displayable error string.
|
// attempt to decode a displayable error string.
|
||||||
var error = JsonConvert.DeserializeObject<OAuthError>(req.GetResponseString() ?? string.Empty);
|
var error = JsonConvert.DeserializeObject<OAuthError>(req.GetResponseString() ?? string.Empty);
|
||||||
if (error != null)
|
if (error != null)
|
||||||
throwableException = new APIException(error.Message, ex);
|
throwableException = new APIException(error.UserDisplayableError, ex);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -201,10 +201,15 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
private class OAuthError
|
private class OAuthError
|
||||||
{
|
{
|
||||||
|
public string UserDisplayableError => !string.IsNullOrEmpty(Hint) ? Hint : ErrorIdentifier;
|
||||||
|
|
||||||
[JsonProperty("error")]
|
[JsonProperty("error")]
|
||||||
public string ErrorType { get; set; }
|
public string ErrorIdentifier { get; set; }
|
||||||
|
|
||||||
[JsonProperty("hint")]
|
[JsonProperty("hint")]
|
||||||
|
public string Hint { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("message")]
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user