Centralise logging of failed ruleset loads

This commit is contained in:
Dean Herbert
2022-08-18 16:14:38 +09:00
parent e0edaf996f
commit b0a740071e
2 changed files with 9 additions and 5 deletions

View File

@ -138,7 +138,7 @@ namespace osu.Game.Rulesets
}
catch (Exception e)
{
Logger.Error(e, $"Failed to load ruleset {filename}");
LogFailedLoad(filename, e);
}
}
@ -158,7 +158,7 @@ namespace osu.Game.Rulesets
}
catch (Exception e)
{
Logger.Error(e, $"Failed to add ruleset {assembly}");
LogFailedLoad(assembly.FullName, e);
}
}
@ -173,6 +173,12 @@ namespace osu.Game.Rulesets
AppDomain.CurrentDomain.AssemblyResolve -= resolveRulesetDependencyAssembly;
}
protected void LogFailedLoad(string name, Exception exception)
{
Logger.Log($"Could not load ruleset {name}. Please check for an update from the developer.", level: LogLevel.Error);
Logger.Log($"Ruleset load failed: {exception}");
}
#region Implementation of IRulesetStore
IRulesetInfo? IRulesetStore.GetRuleset(int id) => GetRuleset(id);