commit 22afbd7a319706889a4c8c843679fc7f485fb65d
parent 6322a52407a3e95ddebbf0fd29f5502b90758f45
Author: Skylar Hill <stellarskylark@posteo.net>
Date: Sat, 4 Jun 2022 16:13:24 -0500
Add parser error handling, increment version
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/rpgsheet.nimble b/rpgsheet.nimble
@@ -1,6 +1,6 @@
# Package
-version = "0.1.3"
+version = "0.1.4"
author = "Skylar Hill"
description = "CLI/TUI application for TTRPG character sheets"
license = "GPL-3.0-only"
diff --git a/src/rpgsheet.nim b/src/rpgsheet.nim
@@ -2,6 +2,7 @@ import
os,
parseopt,
streams,
+ strformat,
yaml
import verb, tui
@@ -18,7 +19,12 @@ Options:
proc loadSheet(file: string): YamlDocument =
let stream = openFileStream(file, fmRead)
- result = loadDom(stream)
+ try:
+ result = loadDom(stream)
+ except YamlLoadingError as e:
+ echo fmt"""Error at {e.mark}:"""
+ echo e.lineContent
+ quit(getCurrentExceptionMsg())
stream.close()
proc main(): void =