THRIFT-1293. cpp: improve handling of exceptions thrown by
process()
Patch: Adam Simpkins
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1161660 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TThreadPoolServer.cpp b/lib/cpp/src/server/TThreadPoolServer.cpp
index 840b835..2204076 100644
--- a/lib/cpp/src/server/TThreadPoolServer.cpp
+++ b/lib/cpp/src/server/TThreadPoolServer.cpp
@@ -68,17 +68,14 @@
break;
}
}
- } catch (TTransportException& ttx) {
+ } catch (const TTransportException& ttx) {
// This is reasonably expected, client didn't send a full request so just
// ignore him
// string errStr = string("TThreadPoolServer client died: ") + ttx.what();
// GlobalOutput(errStr.c_str());
- } catch (TException& x) {
- string errStr = string("TThreadPoolServer exception: ") + x.what();
- GlobalOutput(errStr.c_str());
- } catch (std::exception &x) {
- string errStr = string("TThreadPoolServer, std::exception: ") + x.what();
- GlobalOutput(errStr.c_str());
+ } catch (const std::exception& x) {
+ GlobalOutput.printf("TThreadPoolServer exception %s: %s",
+ typeid(x).name(), x.what());
} catch (...) {
GlobalOutput("TThreadPoolServer, unexpected exception in "
"TThreadPoolServer::Task::run()");