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:
parent
ce6bbf7544
commit
5bda007b63
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user