mirror of
https://github.com/ppy/osu.git
synced 2025-03-20 03:47:28 +08:00
Merge pull request #22105 from frenzibyte/improve-score-import-logging
Improve missing beatmap failure logging on score import
This commit is contained in:
commit
af458f6f66
@ -154,9 +154,12 @@ namespace osu.Game.Database
|
||||
}
|
||||
else
|
||||
{
|
||||
notification.CompletionText = imported.Count == 1
|
||||
? $"Imported {imported.First().GetDisplayString()}!"
|
||||
: $"Imported {imported.Count} {HumanisedModelName}s!";
|
||||
if (tasks.Length > imported.Count)
|
||||
notification.CompletionText = $"Imported {imported.Count} of {tasks.Length} {HumanisedModelName}s.";
|
||||
else if (imported.Count > 1)
|
||||
notification.CompletionText = $"Imported {imported.Count} {HumanisedModelName}s!";
|
||||
else
|
||||
notification.CompletionText = $"Imported {imported.First().GetDisplayString()}!";
|
||||
|
||||
if (imported.Count > 0 && PresentImport != null)
|
||||
{
|
||||
|
@ -46,10 +46,12 @@ namespace osu.Game.Scoring.Legacy
|
||||
score.ScoreInfo = scoreInfo;
|
||||
|
||||
int version = sr.ReadInt32();
|
||||
string beatmapHash = sr.ReadString();
|
||||
|
||||
workingBeatmap = GetBeatmap(beatmapHash);
|
||||
|
||||
workingBeatmap = GetBeatmap(sr.ReadString());
|
||||
if (workingBeatmap is DummyWorkingBeatmap)
|
||||
throw new BeatmapNotFoundException();
|
||||
throw new BeatmapNotFoundException(beatmapHash);
|
||||
|
||||
scoreInfo.User = new APIUser { Username = sr.ReadString() };
|
||||
|
||||
@ -334,9 +336,11 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
public class BeatmapNotFoundException : Exception
|
||||
{
|
||||
public BeatmapNotFoundException()
|
||||
: base("No corresponding beatmap for the score could be found.")
|
||||
public string Hash { get; }
|
||||
|
||||
public BeatmapNotFoundException(string hash)
|
||||
{
|
||||
Hash = hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,9 @@ namespace osu.Game.Scoring
|
||||
|
||||
protected override ScoreInfo? CreateModel(ArchiveReader archive)
|
||||
{
|
||||
using (var stream = archive.GetStream(archive.Filenames.First(f => f.EndsWith(".osr", StringComparison.OrdinalIgnoreCase))))
|
||||
string name = archive.Filenames.First(f => f.EndsWith(".osr", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
using (var stream = archive.GetStream(name))
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -52,7 +54,7 @@ namespace osu.Game.Scoring
|
||||
}
|
||||
catch (LegacyScoreDecoder.BeatmapNotFoundException e)
|
||||
{
|
||||
Logger.Log(e.Message, LoggingTarget.Information, LogLevel.Error);
|
||||
Logger.Log($@"Score '{name}' failed to import: no corresponding beatmap with the hash '{e.Hash}' could be found.", LoggingTarget.Database);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user