1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-05 18:41:05 +00:00

Fix server crashing on Lua errors

Previously, the server called FATAL_ERROR when a Lua error occured.
This caused a (mostly useless) core dump.
The server now simply throws an exception, which is caught and printed before
exiting with a non-zero return value.
This also fixes a number of instances where errors were logged multiple times.
This commit is contained in:
ShadowNinja 2015-10-29 14:48:10 -04:00
parent b872df6ef6
commit 9269a0ecc7
10 changed files with 58 additions and 80 deletions

View file

@ -243,8 +243,12 @@ void* AsyncWorkerThread::run()
lua_State *L = getStack();
std::string script = getServer()->getBuiltinLuaPath() + DIR_DELIM + "init.lua";
if (!loadScript(script)) {
FATAL_ERROR("execution of async base environment failed!");
try {
loadScript(script);
} catch (const ModError &e) {
errorstream << "Execution of async base environment failed: "
<< e.what() << std::endl;
FATAL_ERROR("Execution of async base environment failed");
}
int error_handler = PUSH_ERROR_HANDLER(L);