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/TSimpleServer.cpp b/lib/cpp/src/server/TSimpleServer.cpp
index c0fd67c..0e5a967 100644
--- a/lib/cpp/src/server/TSimpleServer.cpp
+++ b/lib/cpp/src/server/TSimpleServer.cpp
@@ -102,12 +102,12 @@
           break;
         }
       }
-    } catch (TTransportException& ttx) {
+    } catch (const TTransportException& ttx) {
       string errStr = string("TSimpleServer client died: ") + ttx.what();
       GlobalOutput(errStr.c_str());
-    } catch (TException& tx) {
-      string errStr = string("TSimpleServer exception: ") + tx.what();
-      GlobalOutput(errStr.c_str());
+    } catch (const std::exception& x) {
+      GlobalOutput.printf("TSimpleServer exception: %s: %s",
+                          typeid(x).name(), x.what());
     } catch (...) {
       GlobalOutput("TSimpleServer uncaught exception.");
     }