]> granicus.if.org Git - apache/blobdiff - modules/lua/lua_vmprep.c
Be more verbose when logging syntax errors
[apache] / modules / lua / lua_vmprep.c
index 7c383ca94a8b9846cd94c4fab06c6fdef193fba8..1ffe5e2559100f43d8b46c23dade406a1cad5bec 100644 (file)
@@ -357,24 +357,10 @@ static apr_status_t vm_construct(void **vm, void *params, apr_pool_t *lifecycle_
             "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, APLOGNO(01482)
-                "Loading lua file %s: %s",
-                spec->file, err);
+                          "Error loading %s: %s", spec->file,
+                          rc == LUA_ERRMEM ? "memory allocation error"
+                                           : lua_tostring(L, 0));
             return APR_EBADF;
         }
         lua_pcall(L, 0, LUA_MULTRET, 0);