This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new b198c03  chore: check if the configuration file is loaded (#4900)
b198c03 is described below

commit b198c0377c20a2331514a3ac9361ea16f17f8496
Author: 罗泽轩 <[email protected]>
AuthorDate: Thu Aug 26 10:33:19 2021 +0800

    chore: check if the configuration file is loaded (#4900)
---
 apisix/plugin.lua | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/apisix/plugin.lua b/apisix/plugin.lua
index c158011..b467e64 100644
--- a/apisix/plugin.lua
+++ b/apisix/plugin.lua
@@ -231,7 +231,13 @@ function _M.load(config)
 
     if not config then
         -- called during starting or hot reload in admin
-        local_conf = core.config.local_conf(true)
+        local err
+        local_conf, err = core.config.local_conf(true)
+        if not local_conf then
+            -- the error is unrecoverable, so we need to raise it
+            error("failed to load the configuration file: ", err)
+        end
+
         http_plugin_names = local_conf.plugins
         stream_plugin_names = local_conf.stream_plugins
     else

Reply via email to