mirror of
https://github.com/ppy/osu
synced 2025-01-03 04:42:10 +00:00
Unify error handling
This commit is contained in:
parent
668f36d7f3
commit
0ab3982494
@ -36,8 +36,9 @@ namespace osu.Game.Beatmaps
|
||||
using (var stream = new LineBufferedReader(store.GetStream(getPathForFile(BeatmapInfo.Path))))
|
||||
return Decoder.GetDecoder<Beatmap>(stream).Decode(stream);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Beatmap failed to load");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -59,8 +60,9 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
return textureStore.Get(getPathForFile(Metadata.BackgroundFile));
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Background failed to load");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -74,8 +76,9 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
return new VideoSprite(textureStore.GetStream(getPathForFile(Metadata.VideoFile)));
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Video failed to load");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -86,8 +89,9 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
return (trackStore ??= AudioManager.GetTrackStore(store)).Get(getPathForFile(Metadata.AudioFile));
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Track failed to load");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -115,8 +119,9 @@ namespace osu.Game.Beatmaps
|
||||
var trackData = store.GetStream(getPathForFile(Metadata.AudioFile));
|
||||
return trackData == null ? null : new Waveform(trackData);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Waveform failed to load");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -184,14 +184,16 @@ namespace osu.Game.Beatmaps
|
||||
}
|
||||
catch (AggregateException ae)
|
||||
{
|
||||
foreach (var e in ae.InnerExceptions)
|
||||
{
|
||||
if (e is TaskCanceledException)
|
||||
continue;
|
||||
|
||||
Logger.Log(e.Message);
|
||||
}
|
||||
// This is the exception that is generally expected here, which occurs via natural cancellation of the asynchronous load
|
||||
if (ae.InnerExceptions.FirstOrDefault() is TaskCanceledException)
|
||||
return null;
|
||||
|
||||
Logger.Error(ae, "Beatmap failed to load");
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Beatmap failed to load");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user