Prepend "Lua: " before lua exceptions
authorBřetislav Štec <valsiterb@gmail.com>
Sat, 1 Aug 2015 20:52:28 +0000 (22:52 +0200)
committerkwolekr <kwolekr@minetest.net>
Sun, 2 Aug 2015 06:17:37 +0000 (02:17 -0400)
src/server.cpp
src/emerge.cpp

src/emerge.cpp
src/server.cpp

index de9a16ac749c0500def8413d335c376f4b2edbf3..d6bda731a2e8ad21e907d527e805e60f2e2e0ee2 100644 (file)
@@ -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));
index 70fe5ae2c6fc98e4d9927ab75bd77662ac04bbb6..8a1465faa11d09167c55e7d1aefda54f9ce475dc 100644 (file)
@@ -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()));
                }
        }