From b6905ebcf638d2575d1dccb11ecb66f8645f3a9d Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Fri, 3 May 2013 15:08:30 +0200 Subject: [PATCH] Replace abort() in guards of dofile2() with error() Here error() is called in a protected environment. We get an error message back instead of instantly terminating the program. Signed-off-by: Tobias Ulmer --- generic/e2lib.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 99e3225..42ba5e9 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1192,12 +1192,15 @@ function e2lib.dofile2(path, gtable, allownewdefs) if x then return x else - e2lib.abort(path, ": attempt to reference undefined global variable '", k, "'") + error(string.format( + "%s: attempt to reference undefined global variable '%s'", + path, tostring(k)), 0) end end local function checkwrite(t, k, v) - e2lib.abort(path, ": attempt to set new global variable `", k, "' to ", v) + error(string.format("%s: attempt to set new global variable `%s' to %s", + path, tostring(k), tostring(v)), 0) end if not allownewdefs then -- 2.39.5