1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 14:07:25 +08:00
osu-lazer/osu.Game.Tests
Dean Herbert 0267aed846 Change ToMod to return an UnknownMod rather than throw if a mod isn't available
As seen by this kind of crash, having the `.ToMod` method throw can be
very problematic and also hidden (as it is used inside of models in
places where exceptions are not expected to occur).

Given there are tens of usages of this method, returning a placeholder
mod seems like a better idea than outright throwing.

```
 An unhandled has occurred.
 System.InvalidOperationException:
There is no mod in the ruleset (osu) matching the acronym AS.
 at osu.Game.Online.API.APIMod.ToMod(Ruleset ruleset) in /Users/dean/Projects/osu/osu.Game/Online/API/APIMod.cs:line 54
 at osu.Game.Scoring.ScoreInfo.<get_Mods>b__117_0(APIMod m) in /Users/dean/Projects/osu/osu.Game/Scoring/ScoreInfo.cs:line 193
 at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
 at osu.Game.Scoring.ScoreInfo.get_Mods() in /Users/dean/Projects/osu/osu.Game/Scoring/ScoreInfo.cs:line 193
 at osu.Game.Screens.Select.Leaderboards.BeatmapLeaderboard.<>c.<subscribeToLocalScores>b__40_2(ScoreInfo s) in /Users/dean/Projects/osu/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs:line 199
 at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
 at osu.Game.Database.RealmObjectExtensions.Detach[T](IEnumerable`1 items) in /Users/dean/Projects/osu/osu.Game/Database/RealmObjectExtensions.cs:line 180
 at osu.Game.Screens.Select.Leaderboards.BeatmapLeaderboard.<>c__DisplayClass40_0.<subscribeToLocalScores>g__localScoresChanged|1(IRealmCollection`1 sender, ChangeSet changes, Exception exception) in /Users/dean/Projects/osu/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs:line
209
 at Realms.RealmCollectionBase`1.Realms.INotifiable<Realms.NotifiableObjectHandleBase.CollectionChangeSet>.NotifyCallbacks(Nullable`1 changes, Nullable`1 exception)
 at Realms.NotifiableObjectHandleBase.NotifyObjectChanged(IntPtr managedHandle, IntPtr changes, IntPtr exception)
```
2022-03-09 17:57:55 +09:00
..
Audio Move visual test to correct namespace 2021-09-30 15:19:15 +09:00
Beatmaps Add tests 2022-01-28 19:29:30 +09:00
Chat Add a centralised constant for the osu URL schema protocol 2022-02-18 15:57:37 +09:00
Collections/IO Update remaining usages of GetSuitableHost in template projects 2022-01-25 14:15:29 +09:00
Database Add extension method to detect and isolate realm collection-level changes 2022-03-08 14:50:47 +09:00
Editing Revert local registrations in test scenes 2022-02-18 16:52:34 +09:00
Gameplay Add failing test case 2022-03-02 20:32:41 +03:00
Input Clean up unused resolved properties 2021-12-03 18:49:49 +09:00
Localisation Move common interface implementations to extension methods 2021-10-05 14:41:14 +09:00
Models Make BeatmapSet.Metadata non-null 2021-11-24 15:03:34 +09:00
Mods Fix clear identifier typos 2021-12-27 20:26:28 -08:00
NonVisual Rename "client" fields in tests to specify whether spectator or multiplayer 2022-02-16 09:52:18 +09:00
Online Change ToMod to return an UnknownMod rather than throw if a mod isn't available 2022-03-09 17:57:55 +09:00
OnlinePlay Remove beatmap bindable from PlaylistItem 2022-02-15 23:50:08 +09:00
Resources Add a test EF database 2022-02-15 16:56:00 +09:00
Rulesets Update tests to match new behaviour 2022-02-21 18:19:55 +09:00
Scores/IO Remove Task from the inner-most Import method in RealmArchiveModelImporter 2022-01-25 15:30:29 +09:00
ScrollAlgorithms Add test cases for sequential scroll algorithm 2020-05-21 21:56:59 +02:00
Skins Remove ILive<> interface (and use abstract Live<> instead) 2022-01-26 13:38:56 +09:00
Testing Update mock RulesetInfo usage to set OnlineID instead of ID 2021-11-24 15:50:26 +09:00
Utils Add tests showing expected behaviour of naming helper 2022-02-17 00:28:13 +01:00
Visual Merge pull request #17161 from smoogipoo/fix-listing-score-conversion 2022-03-09 13:32:45 +09:00
ImportTest.cs Replace usages of Wait with WaitSafely 2022-01-04 11:51:41 +09:00
osu.Game.Tests.csproj Revert NUnit3TestAdaptor (again) 2022-02-15 17:06:34 +09:00
tests.ruleset Exclude tests from ConfigureAwait rule 2021-03-08 14:36:35 +09:00
WaveformTestBeatmap.cs Retrieve separated skin instance from working beatmap for editing 2021-08-15 21:18:09 +02:00