1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:13:31 +08:00
osu-lazer/osu.Game/Online
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
..
API Change ToMod to return an UnknownMod rather than throw if a mod isn't available 2022-03-09 17:57:55 +09:00
Chat Remove redundant parameter specification 2022-02-24 16:02:16 +09:00
Leaderboards Add localisation support for leaderboard error text 2022-03-02 14:14:44 +09:00
Multiplayer Merge branch 'master' into remove-playlistitem-beatmap 2022-02-16 14:24:57 +09:00
Placeholders Add localisation support for leaderboard error text 2022-03-02 14:14:44 +09:00
Rooms Fix several oversights in data linking causing drawable rooms not updating as expected 2022-02-24 16:12:15 +09:00
Solo Remove user from SubmittableScore 2022-03-08 18:38:24 +09:00
Spectator Remove verbose logging from SpectatorClient for now 2022-02-25 22:25:36 +09:00
BeatmapDownloadTracker.cs Update remaining cases of clashes with realm.Write and realm.RegisterForNotifications 2022-01-25 13:09:48 +09:00
DevelopmentEndpointConfiguration.cs Add website root URL and update most links to use it 2020-12-24 18:11:42 +09:00
DownloadState.cs Rename download state Downloaded to Importing 2021-01-13 18:04:53 +03:00
DownloadTracker.cs Implement new version of download tracker 2021-10-27 21:00:46 +09:00
EndpointConfiguration.cs Add website root URL and update most links to use it 2020-12-24 18:11:42 +09:00
HubClientConnector.cs Replace usage of TypeNameHandling.All with custom type converter 2021-11-11 14:04:19 +09:00
IHubClientConnector.cs Move HubClientConnector retrieval to IAPIProvider 2021-02-15 16:43:56 +09:00
OnlineViewContainer.cs Allow creating OnlineViewContainers with no placeholder button 2021-04-06 16:17:20 +09:00
PollingComponent.cs Ensure PollingComponent.Poll is always called from the update thread 2022-01-28 13:44:11 +09:00
ProductionEndpointConfiguration.cs Add website root URL and update most links to use it 2020-12-24 18:11:42 +09:00
ScoreDownloadTracker.cs Update remaining cases of clashes with realm.Write and realm.RegisterForNotifications 2022-01-25 13:09:48 +09:00
SignalRDerivedTypeWorkaroundJsonConverter.cs BASE_DERIVED -> BASE_TYPE_MAPPING 2021-11-21 06:30:14 +03:00
SignalRUnionWorkaroundResolver.cs Fix union resolver failing on multiple derived types 2022-02-24 20:27:22 +09:00
SignalRWorkaroundTypes.cs BASE_DERIVED -> BASE_TYPE_MAPPING 2021-11-21 06:30:14 +03:00