summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-29 21:37:15 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-29 21:37:15 +0100
commitaef6b23a4a5b0a37a8a5801c61ee31f360a29088 (patch)
tree2ea2b9fb4002528ea9c9c006014b6b0104a7484d
parent19e1d97fcb62464d9a5e86f325e19b8731a7fa74 (diff)
downloadlace-aef6b23a4a5b0a37a8a5801c61ee31f360a29088.tar.gz
Ensure errors are flattened into strings
-rw-r--r--lib/lace/compiler.lua7
-rw-r--r--lib/lace/engine.lua6
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/lace/compiler.lua b/lib/lace/compiler.lua
index 754e680..5d43547 100644
--- a/lib/lace/compiler.lua
+++ b/lib/lace/compiler.lua
@@ -151,6 +151,13 @@ local function compile_ruleset(ctx, src, cnt)
if not ok then
return nil, ret
end
+
+ if type(msg) == "table" then
+ -- TODO: Extract position information etc from error and
+ -- formulate a gorgeous multiline error message.
+ msg = msg.msg or "Empty error"
+ end
+
return ret, msg
end
diff --git a/lib/lace/engine.lua b/lib/lace/engine.lua
index b72db5f..8e93ae0 100644
--- a/lib/lace/engine.lua
+++ b/lib/lace/engine.lua
@@ -74,6 +74,12 @@ local function run_ruleset(ruleset, exec_context)
return false, "Ruleset did not explicitly allow or deny"
end
+ if type(msg) == "table" then
+ -- TODO: Extract position information etc from error and
+ -- formulate a gorgeous multiline error message.
+ msg = msg.msg or "Empty error"
+ end
+
return ret, msg
end