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:
commit
01a85ce60b
1 changed files with 15 additions and 1 deletions
|
@ -160,7 +160,21 @@ void ServerSocketInterface::readClient()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CommandContainer newCommandContainer;
|
CommandContainer newCommandContainer;
|
||||||
newCommandContainer.ParseFromArray(inputBuffer.data(), messageLength);
|
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);
|
inputBuffer.remove(0, messageLength);
|
||||||
messageInProgress = false;
|
messageInProgress = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue