Merge pull request #1048 from ctrlaltca/crashed_into_you

Catch std exceptions thrown by protobuf and try to pretty print them
This commit is contained in:
woogerboy21 2015-05-03 08:00:31 -04:00
commit 01a85ce60b

View file

@ -160,7 +160,21 @@ void ServerSocketInterface::readClient()
return;
CommandContainer newCommandContainer;
try {
newCommandContainer.ParseFromArray(inputBuffer.data(), messageLength);
}
catch(std::exception &e) {
qDebug() << "Caught std::exception in" << __FILE__ << __LINE__ << __PRETTY_FUNCTION__;
qDebug() << "Exception:" << e.what();
qDebug() << "Message coming from:" << getAddress();
qDebug() << "Message length:" << messageLength;
qDebug() << "Message content:" << inputBuffer.toHex();
}
catch(...) {
qDebug() << "Unhandled exception in" << __FILE__ << __LINE__ << __PRETTY_FUNCTION__;
qDebug() << "Message coming from:" << getAddress();
}
inputBuffer.remove(0, messageLength);
messageInProgress = false;