commit 75d2dc8b6e84571f365d87e34a5972757e8d1504
parent 525b4b3c46ea964a66f18c38c0d747367a1f1806
Author: Egg Milk Soup <egg@milksoup.net>
Date: Thu, 9 Jun 2022 12:25:06 -0500
add some basic error handling
has not had thorough testing
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/verb.nim b/src/verb.nim
@@ -41,6 +41,8 @@ proc calculateModifier*(exp: string, sheet: YamlDocument): string =
if code == 0:
working = output.strip
return working
+ else:
+ return "Error: " & output
if sheet.root["expressions"].contains exp:
let subExp = sheet.expression(exp)
@@ -60,6 +62,8 @@ proc roll*(action: string, sheet: YamlDocument): string =
if code == 0:
# rolldice returns its input; the actual roll is the second line
return " " & output.splitLines[1]
+ else:
+ return "Error: " & output
var exp: YamlNode
try:
@@ -90,6 +94,8 @@ proc roll*(action: string, sheet: YamlDocument): string =
if code == 0:
# rolldice returns its input; the actual roll is the second line
result = output.splitLines[1]
+ else:
+ return "Error: " & output
proc view(action: string, sheet: YamlDocument): string =