Skip to content

Commit c9ad0e4

Browse files
authored
Adjust score submission error handling slightly (ppy#37474)
Based on internal feedback. I was going to apply other changes (like always posting to sentry) but don't want to go too far down a rabbit hole, so just fixed messaging a bit.
1 parent f1ea3b3 commit c9ad0e4

1 file changed

Lines changed: 24 additions & 23 deletions

File tree

osu.Game/Screens/Play/SubmittingPlayer.cs

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -144,28 +144,7 @@ void handleTokenFailure(Exception exception, bool displayNotification = false)
144144
if (string.IsNullOrEmpty(exception.Message))
145145
Logger.Error(exception, $"Failed to retrieve a score submission token.\n\n{whatWillHappen}");
146146
else
147-
{
148-
switch (exception.Message)
149-
{
150-
case @"missing token header":
151-
case @"invalid client hash":
152-
case @"invalid verification hash":
153-
Logger.Log($"Please ensure that you are using the latest version of the official game releases.\n\n{whatWillHappen}", level: LogLevel.Important);
154-
break;
155-
156-
case @"invalid or missing beatmap_hash":
157-
Logger.Log($"This beatmap does not match the online version. Please update or redownload it.\n\n{whatWillHappen}", level: LogLevel.Important);
158-
break;
159-
160-
case @"expired token":
161-
Logger.Log($"Your system clock is set incorrectly. Please check your system time, date and timezone.\n\n{whatWillHappen}", level: LogLevel.Important);
162-
break;
163-
164-
default:
165-
Logger.Log($"{whatWillHappen} {exception.Message}", level: LogLevel.Important);
166-
break;
167-
}
168-
}
147+
Logger.Log($"{getUserFacingAPIError(exception)}\n\n{whatWillHappen}", level: LogLevel.Important);
169148
}
170149

171150
if (shouldExit)
@@ -346,14 +325,36 @@ private Task submitScore(Score score)
346325

347326
request.Failure += e =>
348327
{
349-
Logger.Error(e, $"Failed to submit score (token:{token.Value}): {e.Message}");
328+
Logger.Error(e, $"{getUserFacingAPIError(e)}\n\nScore was not submitted (id: {token.Value})");
350329
scoreSubmissionSource.SetResult(false);
351330
};
352331

353332
api.Queue(request);
354333
return scoreSubmissionSource.Task;
355334
}
356335

336+
private static string getUserFacingAPIError(Exception exception)
337+
{
338+
switch (exception.Message)
339+
{
340+
case @"missing token header":
341+
case @"invalid client hash":
342+
case @"invalid verification hash":
343+
case @"invalid token":
344+
case @"outdated client":
345+
return "Please ensure that you are using the latest version of the official game releases.";
346+
347+
case @"invalid or missing beatmap_hash":
348+
return "This beatmap does not match the online version. Please update or redownload it.";
349+
350+
case @"expired token":
351+
return "Your system clock is set incorrectly. Please check your system time, date and timezone.";
352+
353+
default:
354+
return exception.Message;
355+
}
356+
}
357+
357358
protected override ResultsScreen CreateResults(ScoreInfo score) => new SoloResultsScreen(score)
358359
{
359360
AllowRetry = true,

0 commit comments

Comments
 (0)