From: Daniel Earl Poirier Date: Sat, 1 May 2010 12:02:53 +0000 (+0000) Subject: Log error if unable to load lua file. X-Git-Tag: 2.3.6~151 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9fc37b35b1b45157311ee79e99b51d5e6af0123;p=apache 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 --- 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); }