Skip to content

Commit

Permalink
App will not start instead of reseting config when corrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed Jul 29, 2024
1 parent 6663abd commit 0fc837e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Src/RandomizerTMF.Logic/Services/RandomizerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,18 @@ public static RandomizerConfig GetOrCreate(ILogger logger, IFileSystem fileSyste
catch (YamlException ex)
{
logger.LogWarning(ex.InnerException, "Error while deserializing the config file ({configPath}; [{start}] - [{end}]).", Constants.ConfigYml, ex.Start, ex.End);
throw new Exception("Config file is corrupted or incorrectly formatted.");
}
catch (Exception ex)
{
logger.LogWarning(ex, "Error while deserializing the config file ({configPath}).", Constants.ConfigYml);
throw new Exception("Config file is corrupted or there's another problem.");
}
}

if (config is null)
{
logger.LogInformation("Config file not found or is corrupted, creating a new one...");
logger.LogInformation("Config file not found, creating a new one...");
config = new RandomizerConfig(logger, fileSystem);
}

Expand Down

0 comments on commit 0fc837e

Please sign in to comment.