tuned error reporting a bit

This commit is contained in:
Perttu Ahola 2011-04-23 18:53:39 +03:00
parent 179fc8597b
commit ea69a49a7b

@ -1248,11 +1248,6 @@ int main(int argc, char *argv[])
GUI stuff GUI stuff
*/ */
/*
Menu-game loop
*/
while(device->run() && kill == false)
{
/* /*
If an error occurs, this is set to something and the If an error occurs, this is set to something and the
menu-game loop is restarted. It is then displayed before menu-game loop is restarted. It is then displayed before
@ -1260,6 +1255,11 @@ int main(int argc, char *argv[])
*/ */
std::wstring error_message = L""; std::wstring error_message = L"";
/*
Menu-game loop
*/
while(device->run() && kill == false)
{
// This is used for catching disconnects // This is used for catching disconnects
try try
{ {
@ -1404,6 +1404,21 @@ int main(int argc, char *argv[])
dstream<<DTIME<<"Connection error (timed out?)"<<std::endl; dstream<<DTIME<<"Connection error (timed out?)"<<std::endl;
error_message = L"Connection error (timed out?)"; error_message = L"Connection error (timed out?)";
} }
catch(SocketException &e)
{
dstream<<DTIME<<"Socket error (port already in use?)"<<std::endl;
error_message = L"Socket error (port already in use?)";
}
#ifdef NDEBUG
catch(std::exception &e)
{
narrow_message = "Some exception, what()=\"";
narrow_message += e.what();
narrow_message += "\"";
dstream<<DTIME<<narrow_message<<std::endl;
error_message = narrow_to_wide(narrow_message);
}
#endif
} // Menu-game loop } // Menu-game loop