mirror of
https://github.com/Raymonf/whack.git
synced 2025-02-17 10:48:32 +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 System.Text;
|
||||||
using Tommy;
|
using Tommy;
|
||||||
using UAssetAPI;
|
using UAssetAPI;
|
||||||
|
using UAssetAPI.Kismet.Bytecode.Expressions;
|
||||||
using UAssetAPI.PropertyTypes.Structs;
|
using UAssetAPI.PropertyTypes.Structs;
|
||||||
using UAssetAPI.UnrealTypes;
|
using UAssetAPI.UnrealTypes;
|
||||||
using WhackTranslationTool.Exceptions;
|
using WhackTranslationTool.Exceptions;
|
||||||
@ -33,7 +34,20 @@ public class TableImporter
|
|||||||
private void ReadStrings(string tomlPath)
|
private void ReadStrings(string tomlPath)
|
||||||
{
|
{
|
||||||
using var reader = File.OpenText(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)
|
foreach (var (key, value) in table.RawTable)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(key))
|
if (string.IsNullOrEmpty(key))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user