Skip to content

Commit

Permalink
only display error message and not unhandled exception if values file…
Browse files Browse the repository at this point in the history
… couldn't be loaded (#1331)
  • Loading branch information
cadon committed Feb 17, 2024
1 parent 42b0684 commit 96aca7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ARKBreedingStats/FileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static bool LoadJsonFile<T>(string filePath, out T data, out string error
if (data != null)
return true;

errorMessage = $"File\n{Path.GetFullPath(filePath)}\n contains no readable data.";
errorMessage = $"File\n{Path.GetFullPath(filePath)}\ncontains no readable data.";
return false;
}
}
Expand Down
6 changes: 6 additions & 0 deletions ARKBreedingStats/values/ValuesFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ protected static bool TryLoadValuesFile(string filePath, bool setModFileName, bo
if (throwExceptionOnFail)
throw new FormatException(errorMessage);
}
catch (FileLoadException ex)
{
errorMessage = ex.Message;
if (throwExceptionOnFail)
throw;
}
return false;
}
}
Expand Down

0 comments on commit 96aca7b

Please sign in to comment.