mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:02:54 +08:00
Throw and log instead of silently failing on type/instance creation failure
This commit is contained in:
parent
364fa068b3
commit
4ed794e434
@ -147,12 +147,12 @@ namespace osu.Game.Stores
|
|||||||
var type = Type.GetType(r.InstantiationInfo);
|
var type = Type.GetType(r.InstantiationInfo);
|
||||||
|
|
||||||
if (type == null)
|
if (type == null)
|
||||||
continue;
|
throw new InvalidOperationException(@"Type resolution failure.");
|
||||||
|
|
||||||
var rInstance = (Activator.CreateInstance(type) as Ruleset)?.RulesetInfo;
|
var rInstance = (Activator.CreateInstance(type) as Ruleset)?.RulesetInfo;
|
||||||
|
|
||||||
if (rInstance == null)
|
if (rInstance == null)
|
||||||
continue;
|
throw new InvalidOperationException(@"Instantiation failure.");
|
||||||
|
|
||||||
r.Name = rInstance.Name;
|
r.Name = rInstance.Name;
|
||||||
r.ShortName = rInstance.ShortName;
|
r.ShortName = rInstance.ShortName;
|
||||||
@ -161,9 +161,10 @@ namespace osu.Game.Stores
|
|||||||
|
|
||||||
detachedRulesets.Add(r.Clone());
|
detachedRulesets.Add(r.Clone());
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
r.Available = false;
|
r.Available = false;
|
||||||
|
Logger.Log($"Could not load ruleset {r}: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user