mirror of https://github.com/ppy/osu
Show API human readable error message when chat posting fails
Closes #11902.
This commit is contained in:
parent
119b4e8174
commit
254f9bb58b
|
@ -152,7 +152,7 @@ void dequeueAndRun()
|
||||||
|
|
||||||
createNewPrivateMessageRequest.Failure += exception =>
|
createNewPrivateMessageRequest.Failure += exception =>
|
||||||
{
|
{
|
||||||
Logger.Error(exception, "Posting message failed.");
|
handlePostException(exception);
|
||||||
target.ReplaceMessage(message, null);
|
target.ReplaceMessage(message, null);
|
||||||
dequeueAndRun();
|
dequeueAndRun();
|
||||||
};
|
};
|
||||||
|
@ -171,7 +171,7 @@ void dequeueAndRun()
|
||||||
|
|
||||||
req.Failure += exception =>
|
req.Failure += exception =>
|
||||||
{
|
{
|
||||||
Logger.Error(exception, "Posting message failed.");
|
handlePostException(exception);
|
||||||
target.ReplaceMessage(message, null);
|
target.ReplaceMessage(message, null);
|
||||||
dequeueAndRun();
|
dequeueAndRun();
|
||||||
};
|
};
|
||||||
|
@ -184,6 +184,14 @@ void dequeueAndRun()
|
||||||
dequeueAndRun();
|
dequeueAndRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void handlePostException(Exception exception)
|
||||||
|
{
|
||||||
|
if (exception is APIException apiException)
|
||||||
|
Logger.Log(apiException.Message, level: LogLevel.Important);
|
||||||
|
else
|
||||||
|
Logger.Error(exception, "Posting message failed.");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Posts a command locally. Commands like /help will result in a help message written in the current channel.
|
/// Posts a command locally. Commands like /help will result in a help message written in the current channel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue