diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-11-24 14:32:05 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2015-11-24 14:32:05 +0000 |
commit | 4665154a4f1cc63d80f6cb6024cb69b111560779 (patch) | |
tree | 7d12bdb862ef3553ce2ffdc7d88f999360a946b0 | |
parent | 5e6124ea7eb07797e2df2d8ea5aa07e951ed4168 (diff) | |
download | lace-4665154a4f1cc63d80f6cb6024cb69b111560779.tar.gz |
lace.builtin: Offset anyof/allof error messages
-rw-r--r-- | lib/lace/builtin.lua | 10 |
1 files changed, 9 insertions, 1 deletions
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 |