From aef6b23a4a5b0a37a8a5801c61ee31f360a29088 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Tue, 29 May 2012 21:37:15 +0100 Subject: Ensure errors are flattened into strings --- lib/lace/compiler.lua | 7 +++++++ lib/lace/engine.lua | 6 ++++++ 2 files changed, 13 insertions(+) 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 -- cgit v1.2.1