diff options
author | sfan5 <sfan5@live.de> | 2021-09-10 23:16:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 23:16:46 +0200 |
commit | 766e885a1b1c5afb7a62f11b427b6d135adeab87 (patch) | |
tree | 5fc2194936c5ad9702eba44c8636758645f98712 /src/server.cpp | |
parent | 7423c4c11e01edecd8db18b147bab4d2f3eeb471 (diff) | |
download | minetest-766e885a1b1c5afb7a62f11b427b6d135adeab87.tar.gz minetest-766e885a1b1c5afb7a62f11b427b6d135adeab87.tar.bz2 minetest-766e885a1b1c5afb7a62f11b427b6d135adeab87.zip |
Clean up/improve some scriptapi error handling code
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server.cpp b/src/server.cpp index 46b497d6e..8474bc6f1 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -103,7 +103,13 @@ void *ServerThread::run() * doesn't busy wait) and will process any remaining packets. */ - m_server->AsyncRunStep(true); + try { + m_server->AsyncRunStep(true); + } catch (con::ConnectionBindFailed &e) { + m_server->setAsyncFatalError(e.what()); + } catch (LuaError &e) { + m_server->setAsyncFatalError(e); + } while (!stopRequested()) { try { @@ -117,8 +123,7 @@ void *ServerThread::run() } catch (con::ConnectionBindFailed &e) { m_server->setAsyncFatalError(e.what()); } catch (LuaError &e) { - m_server->setAsyncFatalError( - "ServerThread::run Lua: " + std::string(e.what())); + m_server->setAsyncFatalError(e); } } |