]> git.e2factory.org Git - e2factory.git/commitdiff
projenv: report the real error, not misleading follow up
authorTobias Ulmer <tu@emlix.com>
Fri, 28 Oct 2016 14:25:39 +0000 (16:25 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/projenv.lua

index acfdfda3b1ec3eb262d68d323a60c842643832a2..0e319672d6bee946d8495f035d89b8956dc4b1e4 100644 (file)
@@ -61,6 +61,8 @@ local function _load_env_config(file)
         -- upvalues: file, _load_env_config(), merge_error
         local rc, re
 
+        assert(merge_error == false, "merge_error already set")
+
         if type(data) == "string" then
             -- filename
             rc, re = _load_env_config(data)
@@ -115,7 +117,8 @@ local function _load_env_config(file)
             -- simulate a table that's updating itself as we read the config
             -- called for env[key] and e2env[key]
             v = projenv.safe_global_res_env_table()[key]
-            if v == nil then
+            if v == nil and merge_error == false then
+                -- if merge_error is set, don't spew false warnings
                 e2lib.warnf("WOTHER",
                     "in project environment, key lookup for %q returned 'nil'",
                     tostring(key))
@@ -135,13 +138,15 @@ local function _load_env_config(file)
         string = e2lib.safe_string_table(),
     }
     rc, re = e2lib.dofile2(path, g)
+    -- report the most precise error first
+    if merge_error then
+        return false, e:cat(merge_error)
+    end
+
     if not rc then
         return false, e:cat(re)
     end
 
-    if merge_error then
-        return false, merge_error
-    end
     return true
 end