diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-10-29 14:48:10 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2015-10-31 13:28:58 -0400 |
commit | 9269a0ecc7267822bc5ac5af95ad4977bdc94fec (patch) | |
tree | 1cf8639cc0a6b367670ac673780f321f85b467be /src/guiEngine.cpp | |
parent | b872df6ef6a15ae4624b35ea7b8960bc24da1128 (diff) | |
download | minetest-9269a0ecc7267822bc5ac5af95ad4977bdc94fec.tar.gz minetest-9269a0ecc7267822bc5ac5af95ad4977bdc94fec.tar.bz2 minetest-9269a0ecc7267822bc5ac5af95ad4977bdc94fec.zip |
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.
Diffstat (limited to 'src/guiEngine.cpp')
-rw-r--r-- | src/guiEngine.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp index c616bc322..84bc8488e 100644 --- a/src/guiEngine.cpp +++ b/src/guiEngine.cpp @@ -238,13 +238,13 @@ bool GUIEngine::loadMainMenuScript() } std::string script = porting::path_share + DIR_DELIM "builtin" + DIR_DELIM "init.lua"; - if (m_script->loadScript(script)) { + try { + m_script->loadScript(script); // Menu script loaded return true; - } else { - infostream - << "GUIEngine: execution of menu script in: \"" - << m_scriptdir << "\" failed!" << std::endl; + } catch (const ModError &e) { + errorstream << "GUIEngine: execution of menu script failed: " + << e.what() << std::endl; } return false; |