From 4665154a4f1cc63d80f6cb6024cb69b111560779 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 24 Nov 2015 14:32:05 +0000 Subject: lace.builtin: Offset anyof/allof error messages --- lib/lace/builtin.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/lace/builtin.lua b/lib/lace/builtin.lua index 147da6a..5f91086 100644 --- a/lib/lace/builtin.lua +++ b/lib/lace/builtin.lua @@ -208,7 +208,15 @@ local function _compile_any_all_of(compcontext, mtype, first, second, ...) end return { - fn = run_conditions, + fn = (function(exec_context, cond, anyof) + local pass, msg = run_conditions(exec_context, cond, anyof) + if pass == nil then + -- Offset error location by anyof/allof word + err.offset(msg, 1) + return nil, msg + end + return pass, msg + end), args = { { first, second, ...}, mtype == "anyof" } } end -- cgit v1.2.1