1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +03:00

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
This commit is contained in:
Daniel Earl Poirier
2010-05-01 12:02:53 +00:00
parent f07bb6b918
commit c9fc37b35b

View File

@@ -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);
}