mirror of
https://github.com/ppy/osu
synced 2025-02-01 19:02:00 +00:00
CA2208: create exceptions correctly.
This commit is contained in:
parent
09257b0c6d
commit
d5994ed484
@ -51,7 +51,6 @@
|
||||
<Rule Id="CA1826" Action="None" />
|
||||
<Rule Id="CA2000" Action="None" />
|
||||
<Rule Id="CA2008" Action="None" />
|
||||
<Rule Id="CA2208" Action="None" />
|
||||
<Rule Id="CA2213" Action="None" />
|
||||
<Rule Id="CA2235" Action="None" />
|
||||
</Rules>
|
||||
|
@ -119,7 +119,7 @@ namespace osu.Game.Graphics
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(screenshotFormat));
|
||||
throw new InvalidOperationException($"Unknown enum member {nameof(ScreenshotFormat)} {screenshotFormat.Value}.");
|
||||
}
|
||||
|
||||
notificationOverlay.Post(new SimpleNotification
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Difficulty.Utils
|
||||
public LimitedCapacityStack(int capacity)
|
||||
{
|
||||
if (capacity < 0)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
throw new ArgumentOutOfRangeException(nameof(capacity));
|
||||
|
||||
this.capacity = capacity;
|
||||
array = new T[capacity];
|
||||
|
@ -150,8 +150,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
if (HitObject.SampleControlPoint == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
|
||||
+ $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
|
||||
throw new InvalidOperationException($"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
|
||||
+ $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
|
||||
}
|
||||
|
||||
samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).ToArray();
|
||||
|
@ -118,7 +118,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
int repeatCount = Parsing.ParseInt(split[6]);
|
||||
|
||||
if (repeatCount > 9000)
|
||||
throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
|
||||
throw new FormatException(@"Repeat count is way too high");
|
||||
|
||||
// osu-stable treated the first span of the slider as a repeat, but no repeats are happening
|
||||
repeatCount = Math.Max(0, repeatCount - 1);
|
||||
|
@ -165,7 +165,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
return miss;
|
||||
|
||||
default:
|
||||
throw new ArgumentException(nameof(result));
|
||||
throw new ArgumentException("Unknown enum member", nameof(result));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Screens.Play
|
||||
: base(() => new ReplayPlayer(score))
|
||||
{
|
||||
if (score.Replay == null)
|
||||
throw new ArgumentNullException(nameof(score.Replay), $"{nameof(score)} must have a non-null {nameof(score.Replay)}.");
|
||||
throw new ArgumentException($"{nameof(score)} must have a non-null {nameof(score.Replay)}.", nameof(score));
|
||||
|
||||
scoreInfo = score.ScoreInfo;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Users
|
||||
private void load(UserProfileOverlay profile)
|
||||
{
|
||||
if (colours == null)
|
||||
throw new ArgumentNullException(nameof(colours));
|
||||
throw new InvalidOperationException($"{nameof(colours)} not initialized!");
|
||||
|
||||
FillFlowContainer infoContainer;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user