mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 21:13:20 +08:00
Add messages to all InvalidOperationException
s
Without this, they can be very non-descript and hard to track down
This commit is contained in:
parent
d43b980a17
commit
569fde4b47
@ -83,14 +83,14 @@ namespace osu.Game.Tests.NonVisual
|
||||
|
||||
public override event Action<JudgementResult> NewResult
|
||||
{
|
||||
add => throw new InvalidOperationException();
|
||||
remove => throw new InvalidOperationException();
|
||||
add => throw new InvalidOperationException($"{nameof(NewResult)} operations not supported in test context");
|
||||
remove => throw new InvalidOperationException($"{nameof(NewResult)} operations not supported in test context");
|
||||
}
|
||||
|
||||
public override event Action<JudgementResult> RevertResult
|
||||
{
|
||||
add => throw new InvalidOperationException();
|
||||
remove => throw new InvalidOperationException();
|
||||
add => throw new InvalidOperationException($"{nameof(RevertResult)} operations not supported in test context");
|
||||
remove => throw new InvalidOperationException($"{nameof(RevertResult)} operations not supported in test context");
|
||||
}
|
||||
|
||||
public override Playfield Playfield { get; }
|
||||
|
@ -273,14 +273,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
public override event Action<JudgementResult> NewResult
|
||||
{
|
||||
add => throw new InvalidOperationException();
|
||||
remove => throw new InvalidOperationException();
|
||||
add => throw new InvalidOperationException($"{nameof(NewResult)} operations not supported in test context");
|
||||
remove => throw new InvalidOperationException($"{nameof(NewResult)} operations not supported in test context");
|
||||
}
|
||||
|
||||
public override event Action<JudgementResult> RevertResult
|
||||
{
|
||||
add => throw new InvalidOperationException();
|
||||
remove => throw new InvalidOperationException();
|
||||
add => throw new InvalidOperationException($"{nameof(RevertResult)} operations not supported in test context");
|
||||
remove => throw new InvalidOperationException($"{nameof(RevertResult)} operations not supported in test context");
|
||||
}
|
||||
|
||||
public override Playfield Playfield { get; }
|
||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
{
|
||||
AddStep("set beatmap", () => advancedStats.BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
Ruleset = rulesets.GetRuleset(3) ?? throw new InvalidOperationException(),
|
||||
Ruleset = rulesets.GetRuleset(3) ?? throw new InvalidOperationException("osu!mania ruleset not found"),
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 5,
|
||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
/// <returns></returns>
|
||||
public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo beatmap = null)
|
||||
{
|
||||
var ruleset = rulesets.GetRuleset(RulesetID) ?? throw new InvalidOperationException();
|
||||
var ruleset = rulesets.GetRuleset(RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {RulesetID} not found locally");
|
||||
|
||||
var rulesetInstance = ruleset.CreateInstance();
|
||||
|
||||
|
@ -79,7 +79,7 @@ namespace osu.Game.Online.Rooms
|
||||
TotalScore = TotalScore,
|
||||
MaxCombo = MaxCombo,
|
||||
BeatmapInfo = beatmap,
|
||||
Ruleset = rulesets.GetRuleset(playlistItem.RulesetID) ?? throw new InvalidOperationException(),
|
||||
Ruleset = rulesets.GetRuleset(playlistItem.RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {playlistItem.RulesetID} not found locally"),
|
||||
Statistics = Statistics,
|
||||
User = User,
|
||||
Accuracy = Accuracy,
|
||||
|
@ -136,7 +136,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
Spacing = new Vector2(2),
|
||||
Children = Score.Mods.Select(mod =>
|
||||
{
|
||||
var ruleset = rulesets.GetRuleset(Score.RulesetID) ?? throw new InvalidOperationException();
|
||||
var ruleset = rulesets.GetRuleset(Score.RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {Score.RulesetID} not found locally");
|
||||
|
||||
return new ModIcon(ruleset.CreateInstance().CreateModFromAcronym(mod.Acronym))
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ namespace osu.Game.Screens.Edit
|
||||
public BeatmapInfo BeatmapInfo
|
||||
{
|
||||
get => beatmapInfo;
|
||||
set => throw new InvalidOperationException();
|
||||
set => throw new InvalidOperationException($"Can't set {nameof(BeatmapInfo)} on {nameof(EditorBeatmap)}");
|
||||
}
|
||||
|
||||
public BeatmapMetadata Metadata => beatmapInfo.Metadata;
|
||||
|
@ -134,7 +134,7 @@ namespace osu.Game.Tests.Visual.Spectator
|
||||
FrameSendAttempts++;
|
||||
|
||||
if (ShouldFailSendingFrames)
|
||||
return Task.FromException(new InvalidOperationException());
|
||||
return Task.FromException(new InvalidOperationException($"Intentional fail via {ShouldFailSendingFrames}"));
|
||||
|
||||
return ((ISpectatorClient)this).UserSentFrames(api.LocalUser.Value.Id, bundle);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user