mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 13:22:55 +08:00
Merge pull request #24928 from peppy/better-erroring-score-import-fail
Improve notification display when score import fails
This commit is contained in:
commit
10e30b05bc
@ -149,7 +149,7 @@ namespace osu.Game.Database
|
||||
return imported;
|
||||
}
|
||||
|
||||
notification.Text = $"{HumanisedModelName.Humanize(LetterCasing.Title)} import failed!";
|
||||
notification.Text = $"{HumanisedModelName.Humanize(LetterCasing.Title)} import failed! Check logs for more information.";
|
||||
notification.State = ProgressNotificationState.Cancelled;
|
||||
}
|
||||
else
|
||||
|
@ -52,16 +52,21 @@ namespace osu.Game.Scoring
|
||||
{
|
||||
return new DatabasedLegacyScoreDecoder(rulesets, beatmaps()).Parse(stream).ScoreInfo;
|
||||
}
|
||||
catch (LegacyScoreDecoder.BeatmapNotFoundException e)
|
||||
catch (LegacyScoreDecoder.BeatmapNotFoundException notFound)
|
||||
{
|
||||
Logger.Log($@"Score '{archive.Name}' failed to import: no corresponding beatmap with the hash '{e.Hash}' could be found.", LoggingTarget.Database);
|
||||
Logger.Log($@"Score '{archive.Name}' failed to import: no corresponding beatmap with the hash '{notFound.Hash}' could be found.", LoggingTarget.Database);
|
||||
|
||||
// In the case of a missing beatmap, let's attempt to resolve it and show a prompt to the user to download the required beatmap.
|
||||
var req = new GetBeatmapRequest(new BeatmapInfo { MD5Hash = e.Hash });
|
||||
req.Success += res => PostNotification?.Invoke(new MissingBeatmapNotification(res, archive, e.Hash));
|
||||
var req = new GetBeatmapRequest(new BeatmapInfo { MD5Hash = notFound.Hash });
|
||||
req.Success += res => PostNotification?.Invoke(new MissingBeatmapNotification(res, archive, notFound.Hash));
|
||||
api.Queue(req);
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($@"Failed to parse headers of score '{archive.Name}': {e}.", LoggingTarget.Database);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user