Skip to content

Commit

Permalink
Prepend "Lua: " before lua exceptions
Browse files Browse the repository at this point in the history
src/server.cpp
src/emerge.cpp
  • Loading branch information
t0suj4 authored and kwolekr committed Aug 2, 2015
1 parent c4287a0 commit a5e5aa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/emerge.cpp
Expand Up @@ -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));
Expand Down
29 changes: 9 additions & 20 deletions src/server.cpp
Expand Up @@ -86,7 +86,7 @@ class ServerThread : public JThread
void * Thread();
};

void * ServerThread::Thread()
void *ServerThread::Thread()
{
log_register_thread("ServerThread");

Expand All @@ -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()));
}
}

Expand Down

0 comments on commit a5e5aa5

Please sign in to comment.