add better error reporting for Overflows
This commit is contained in:
parent
d44da85c86
commit
56a01bb210
|
@ -18,13 +18,19 @@ proc yamlToJson*(file: string): seq[JsonNode] =
|
|||
try:
|
||||
let fs = openFileStream(file)
|
||||
defer: fs.close()
|
||||
try:
|
||||
result = fs.loadToJson()
|
||||
except OverflowError as e:
|
||||
echo "Overflow exception when parsing. Did you stringify 18446744073709551615 (-1)?"
|
||||
echo "Current file: ", file
|
||||
echo "Current position: ", fs.getPosition()
|
||||
var line: string
|
||||
discard fs.peekLine(line)
|
||||
echo "Peek at the line: ", line
|
||||
raise
|
||||
except IOError:
|
||||
echo "Exception when reading file: " & file
|
||||
raise
|
||||
except OverflowError:
|
||||
echo "Overflow exception when parsing. Did you stringify 18446744073709551615 (-1)?"
|
||||
raise
|
||||
|
||||
when isMainModule:
|
||||
# Do not forget to stringify FAR_EPOCH_SLOT = 18446744073709551615 (-1) in the YAML file
|
||||
|
|
Loading…
Reference in New Issue