aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBřetislav Štec <valsiterb@gmail.com>2015-08-01 22:52:28 +0200
committerkwolekr <kwolekr@minetest.net>2015-08-02 02:17:37 -0400
commita5e5aa5be978d2f6e23d4eeab04d2ac9beefe170 (patch)
tree46940d08555ba8c3bac07328b2c6f5848bee9814
parentc4287a0d681abd4728f978d2ac55285cf6a6ecad (diff)
downloadminetest-a5e5aa5be978d2f6e23d4eeab04d2ac9beefe170.tar.gz
minetest-a5e5aa5be978d2f6e23d4eeab04d2ac9beefe170.tar.bz2
minetest-a5e5aa5be978d2f6e23d4eeab04d2ac9beefe170.zip
Prepend "Lua: " before lua exceptions
src/server.cpp src/emerge.cpp
-rw-r--r--src/emerge.cpp4
-rw-r--r--src/server.cpp29
2 files changed, 11 insertions, 22 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp
index de9a16ac7..d6bda731a 100644
--- a/src/emerge.cpp
+++ b/src/emerge.cpp
@@ -494,8 +494,8 @@ void *EmergeThread::Thread()
try { // takes about 90ms with -O1 on an e3-1230v2
m_server->getScriptIface()->environment_OnGenerated(
minp, maxp, mapgen->blockseed);
- } catch(LuaError &e) {
- m_server->setAsyncFatalError(e.what());
+ } catch (LuaError &e) {
+ m_server->setAsyncFatalError("Lua: " + std::string(e.what()));
}
EMERGE_DBG_OUT("ended up with: " << analyze_block(block));
diff --git a/src/server.cpp b/src/server.cpp
index 70fe5ae2c..8a1465faa 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -86,7 +86,7 @@ public:
void * Thread();
};
-void * ServerThread::Thread()
+void *ServerThread::Thread()
{
log_register_thread("ServerThread");
@@ -99,33 +99,22 @@ void * ServerThread::Thread()
porting::setThreadName("ServerThread");
- while(!StopRequested())
- {
- try{
+ while (!StopRequested()) {
+ try {
//TimeTaker timer("AsyncRunStep() + Receive()");
m_server->AsyncRunStep();
m_server->Receive();
- }
- catch(con::NoIncomingDataException &e)
- {
- }
- catch(con::PeerNotFoundException &e)
- {
+ } catch (con::NoIncomingDataException &e) {
+ } catch (con::PeerNotFoundException &e) {
infostream<<"Server: PeerNotFoundException"<<std::endl;
- }
- catch(ClientNotFoundException &e)
- {
- }
- catch(con::ConnectionBindFailed &e)
- {
- m_server->setAsyncFatalError(e.what());
- }
- catch(LuaError &e)
- {
+ } catch (ClientNotFoundException &e) {
+ } catch (con::ConnectionBindFailed &e) {
m_server->setAsyncFatalError(e.what());
+ } catch (LuaError &e) {
+ m_server->setAsyncFatalError("Lua: " + std::string(e.what()));
}
}