Skip to content

Commit

Permalink
Abort early on Lua errors
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Sep 23, 2024
1 parent 8c92b20 commit bdf0d91
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/webserver/civetweb/mod_lua.inl
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,17 @@ run_lsp_kepler(struct mg_connection *conn,
/* Syntax error or OOM.
* Error message is pushed on stack. */
lua_pcall(L, 1, 0, 0);
lua_cry(conn, lua_ok, L, "LSP", "execute"); /* XXX TODO: everywhere ! */
lua_cry(conn, lua_ok, L, "LSP Kepler", "execute");
return 1;

} else {
/* Success loading chunk. Call it. */
lua_ok = lua_pcall(L, 0, 0, 0);
if(lua_ok != LUA_OK)
lua_cry(conn, lua_ok, L, "LSP", "call");
if(lua_ok != LUA_OK)
{
lua_cry(conn, lua_ok, L, "LSP Kepler", "call");
return 1;
}
}
return 0;
}
Expand Down Expand Up @@ -790,11 +794,16 @@ run_lsp_civetweb(struct mg_connection *conn,
/* Syntax error or OOM.
* Error message is pushed on stack. */
lua_pcall(L, 1, 0, 0);
lua_cry(conn, lua_ok, L, "LSP", "execute");
return 1;
} else {
/* Success loading chunk. Call it. */
lua_ok = lua_pcall(L, 0, 0, 0);
if(lua_ok != LUA_OK)
if(lua_ok != LUA_OK)
{
lua_cry(conn, lua_ok, L, "LSP", "call");
return 1;
}
}

/* Progress until after the Lua closing tag. */
Expand Down

0 comments on commit bdf0d91

Please sign in to comment.