mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
catch exception if loading DalamudConfiguration fails
This commit is contained in:
parent
2c02a4b28b
commit
73bb52d1b5
1 changed files with 12 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ using Dalamud.Configuration;
|
|||
using Dalamud.DiscordBot;
|
||||
using Dalamud.Game.Chat;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud
|
||||
{
|
||||
|
|
@ -43,7 +44,17 @@ namespace Dalamud
|
|||
public string ConfigPath;
|
||||
|
||||
public static DalamudConfiguration Load(string path) {
|
||||
var deserialized = JsonConvert.DeserializeObject<DalamudConfiguration>(File.ReadAllText(path));
|
||||
DalamudConfiguration deserialized;
|
||||
try
|
||||
{
|
||||
deserialized = JsonConvert.DeserializeObject<DalamudConfiguration>(File.ReadAllText(path));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex, "Failed to load DalamudConfiguration at {0}", path);
|
||||
deserialized = new DalamudConfiguration();
|
||||
}
|
||||
|
||||
deserialized.ConfigPath = path;
|
||||
|
||||
return deserialized;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue