]> git.e2factory.org Git - e2factory.git/commitdiff
Replace abort() in guards of dofile2() with error()
authorTobias Ulmer <tu@emlix.com>
Fri, 3 May 2013 13:08:30 +0000 (15:08 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 13:58:55 +0000 (14:58 +0100)
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 <tu@emlix.com>
generic/e2lib.lua

index 99e32251702c66d5a93b054af8f7c56ece469f8d..42ba5e9e472363ec2885e6567ae95a9edf850d5e 100644 (file)
@@ -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