mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Standardise usages of exceptions.
This commit is contained in:
@ -94,13 +94,13 @@ namespace osu.Game.Database
|
||||
{
|
||||
byte[] properties = new byte[5];
|
||||
if (replayInStream.Read(properties, 0, 5) != 5)
|
||||
throw new Exception("input .lzma is too short");
|
||||
throw new IOException("input .lzma is too short");
|
||||
long outSize = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
int v = replayInStream.ReadByte();
|
||||
if (v < 0)
|
||||
throw new Exception("Can't Read 1");
|
||||
throw new IOException("Can't Read 1");
|
||||
outSize |= (long)(byte)v << (8 * i);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Graphics
|
||||
switch (hex.Length)
|
||||
{
|
||||
default:
|
||||
throw new Exception(@"Invalid hex string length!");
|
||||
throw new ArgumentException(@"Invalid hex string length!");
|
||||
case 3:
|
||||
return new Color4(
|
||||
(byte)(Convert.ToByte(hex.Substring(0, 1), 16) * 17),
|
||||
|
@ -279,7 +279,7 @@ namespace osu.Game.Rulesets.UI
|
||||
protected abstract Playfield<TObject, TJudgement> CreatePlayfield();
|
||||
}
|
||||
|
||||
public class BeatmapInvalidForRulesetException : Exception
|
||||
public class BeatmapInvalidForRulesetException : ArgumentException
|
||||
{
|
||||
public BeatmapInvalidForRulesetException(string text)
|
||||
: base(text)
|
||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Screens.Play
|
||||
Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true);
|
||||
|
||||
if (Beatmap?.Beatmap == null)
|
||||
throw new Exception("Beatmap was not loaded");
|
||||
throw new InvalidOperationException("Beatmap was not loaded");
|
||||
|
||||
ruleset = osu?.Ruleset.Value ?? Beatmap.BeatmapInfo.Ruleset;
|
||||
rulesetInstance = ruleset.CreateInstance();
|
||||
@ -109,7 +109,7 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
|
||||
if (!HitRenderer.Objects.Any())
|
||||
throw new Exception("Beatmap contains no hit objects!");
|
||||
throw new InvalidOperationException("Beatmap contains no hit objects!");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user