From 5bda007b634435b34a935402e283db1a37967deb Mon Sep 17 00:00:00 2001 From: Raymonf Date: Sat, 5 Nov 2022 14:12:40 -0400 Subject: [PATCH] Minor error handling to figure out TOML errors --- WTT/WTT/TableImporter.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/WTT/WTT/TableImporter.cs b/WTT/WTT/TableImporter.cs index 057c13d..bdba077 100644 --- a/WTT/WTT/TableImporter.cs +++ b/WTT/WTT/TableImporter.cs @@ -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))