1
0
mirror of https://github.com/Raymonf/whack.git synced 2024-11-24 00:20:10 +01:00

Minor error handling to figure out TOML errors

This commit is contained in:
Raymonf 2022-11-05 14:12:40 -04:00
parent ce6bbf7544
commit 5bda007b63
No known key found for this signature in database
GPG Key ID: 438459BF619B037A

View File

@ -1,6 +1,7 @@
using System.Text;
using Tommy;
using UAssetAPI;
using UAssetAPI.Kismet.Bytecode.Expressions;
using UAssetAPI.PropertyTypes.Structs;
using UAssetAPI.UnrealTypes;
using WhackTranslationTool.Exceptions;
@ -33,7 +34,20 @@ public class TableImporter
private void ReadStrings(string tomlPath)
{
using var reader = File.OpenText(tomlPath);
var table = TOML.Parse(reader);
TomlTable table;
try
{
table = TOML.Parse(reader);
}
catch (TomlParseException ex)
{
Console.WriteLine($"*** ERROR: Failed to parse {tomlPath}: {ex.Message}");
foreach (var error in ex.SyntaxErrors)
{
Console.WriteLine($"* Syntax error at line {error.Line}: {error.Message}");
}
throw;
}
foreach (var (key, value) in table.RawTable)
{
if (string.IsNullOrEmpty(key))