This commit is contained in:
Ottermandias 2023-11-17 17:09:11 +01:00
parent 908239bf13
commit 69c493b9d6

View file

@ -52,21 +52,23 @@ public class EphemeralConfig : ISavable
errorArgs.ErrorContext.Handled = true;
}
if (File.Exists(_saveService.FileNames.EphemeralConfigFile))
try
if (!File.Exists(_saveService.FileNames.EphemeralConfigFile))
return;
try
{
var text = File.ReadAllText(_saveService.FileNames.EphemeralConfigFile);
JsonConvert.PopulateObject(text, this, new JsonSerializerSettings
{
var text = File.ReadAllText(_saveService.FileNames.EphemeralConfigFile);
JsonConvert.PopulateObject(text, this, new JsonSerializerSettings
{
Error = HandleDeserializationError,
});
}
catch (Exception ex)
{
Penumbra.Messager.NotificationMessage(ex,
"Error reading ephemeral Configuration, reverting to default.",
"Error reading ephemeral Configuration", NotificationType.Error);
}
Error = HandleDeserializationError,
});
}
catch (Exception ex)
{
Penumbra.Messager.NotificationMessage(ex,
"Error reading ephemeral Configuration, reverting to default.",
"Error reading ephemeral Configuration", NotificationType.Error);
}
}
/// <summary> Save the current configuration. </summary>