Skip to content

Commit

Permalink
Server::step throw is never catched. Replace it with an errorstream +…
Browse files Browse the repository at this point in the history
… assert

This throw can be trigger by LuaError exception or ConnectionBindFailed exception in the following functions:
* EmergeThread::Thread()
* ScriptApiEnv::environment_Step()
* ScriptApiEnv::player_event()
* ServerThread::Thread()
  • Loading branch information
nerzhul committed Mar 16, 2015
1 parent 16b961b commit 5f8e48c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server.cpp
Expand Up @@ -479,10 +479,13 @@ void Server::step(float dtime)
JMutexAutoLock lock(m_step_dtime_mutex);
m_step_dtime += dtime;
}
// Throw if fatal error occurred in thread
// Assert if fatal error occurred in thread
std::string async_err = m_async_fatal_error.get();
if(async_err != ""){
throw ServerError(async_err);
if(async_err != "") {
errorstream << "UNRECOVERABLE error occurred. Stopping server. "
<< "Please fix the following error:" << std::endl
<< async_err << std::endl;
assert(false);
}
}

Expand Down

2 comments on commit 5f8e48c

@ShadowNinja
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert is a no-op in release builds. Use abort, or better yet proper error handling.

@nerzhul
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was reverted and a better fix was pushed and provided, thanks anyway :)

Please sign in to comment.