]> git.e2factory.org Git - e2factory.git/commitdiff
projenv: warn when a key lookup returns nil
authorTobias Ulmer <tu@emlix.com>
Thu, 27 Oct 2016 16:52:47 +0000 (18:52 +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 9dec7c9bbd89dc9dc0fe6bf75c62c0785404dfea..acfdfda3b1ec3eb262d68d323a60c842643832a2 100644 (file)
@@ -111,9 +111,16 @@ local function _load_env_config(file)
 
     local mt = {
         __index = function(t, key)
+            local v
             -- simulate a table that's updating itself as we read the config
             -- called for env[key] and e2env[key]
-            return projenv.safe_global_res_env_table()[key]
+            v = projenv.safe_global_res_env_table()[key]
+            if v == nil then
+                e2lib.warnf("WOTHER",
+                    "in project environment, key lookup for %q returned 'nil'",
+                    tostring(key))
+            end
+            return v
         end,
         __call = function(t, data)
             -- called for env "string" and env {}