From c9fc37b35b1b45157311ee79e99b51d5e6af0123 Mon Sep 17 00:00:00 2001 From: Daniel Earl Poirier Date: Sat, 1 May 2010 12:02:53 +0000 Subject: [PATCH] Log error if unable to load lua file. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@939986 13f79535-47bb-0310-9956-ffa450edef68 --- modules/lua/lua_vmprep.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/lua/lua_vmprep.c b/modules/lua/lua_vmprep.c index 8e4c319650..2adad2efa6 100644 --- a/modules/lua/lua_vmprep.c +++ b/modules/lua/lua_vmprep.c @@ -325,7 +325,31 @@ AP_LUA_DECLARE(lua_State*)ap_lua_get_lua_state(apr_pool_t *lifecycle_pool, lua_pcall(L, 0, LUA_MULTRET, 0); } else { - luaL_loadfile(L, spec->file); + int rc; + ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, lifecycle_pool, + "loading lua file %s", spec->file); + rc = luaL_loadfile(L, spec->file); + if (rc != 0) { + char *err; + switch (rc) { + case LUA_ERRSYNTAX: + err = "syntax error"; + break; + case LUA_ERRMEM: + err = "memory allocation error"; + break; + case LUA_ERRFILE: + err = "error opening or reading file"; + break; + default: + err = "unknown error"; + break; + } + ap_log_perror(APLOG_MARK, APLOG_ERR, 0, lifecycle_pool, + "Loading lua file %s: %s", + spec->file, err); + return NULL; + } lua_pcall(L, 0, LUA_MULTRET, 0); } -- 2.40.0