httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From poir...@apache.org
Subject svn commit: r939986 - /httpd/httpd/trunk/modules/lua/lua_vmprep.c
Date Sat, 01 May 2010 12:02:53 GMT
Author: poirier
Date: Sat May  1 12:02:53 2010
New Revision: 939986

URL: http://svn.apache.org/viewvc?rev=939986&view=rev
Log:
Log error if unable to load lua file.

Modified:
    httpd/httpd/trunk/modules/lua/lua_vmprep.c

Modified: httpd/httpd/trunk/modules/lua/lua_vmprep.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_vmprep.c?rev=939986&r1=939985&r2=939986&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Sat May  1 12:02:53 2010
@@ -325,7 +325,31 @@ AP_LUA_DECLARE(lua_State*)ap_lua_get_lua
             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);
         }
 



Mime
View raw message