1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Throw and log instead of silently failing on type/instance creation failure

This commit is contained in:
Dean Herbert 2021-10-14 14:24:36 +09:00
parent 364fa068b3
commit 4ed794e434

View File

@ -147,12 +147,12 @@ namespace osu.Game.Stores
var type = Type.GetType(r.InstantiationInfo);
if (type == null)
continue;
throw new InvalidOperationException(@"Type resolution failure.");
var rInstance = (Activator.CreateInstance(type) as Ruleset)?.RulesetInfo;
if (rInstance == null)
continue;
throw new InvalidOperationException(@"Instantiation failure.");
r.Name = rInstance.Name;
r.ShortName = rInstance.ShortName;
@ -161,9 +161,10 @@ namespace osu.Game.Stores
detachedRulesets.Add(r.Clone());
}
catch
catch (Exception ex)
{
r.Available = false;
Logger.Log($"Could not load ruleset {r}: {ex.Message}");
}
}