[thrift] Better default TApplicationException messages
Summary: "Default TApplicationException" is pretty meaningless; if we have this
extra type information, we might as well present it.
Reviewed By: mcslee
Test Plan: caught a couple of INVALID_MESSAGE_TYPE tapplicationexceptions
Revert: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665383 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/Thrift.h b/lib/cpp/src/Thrift.h
index ad8d46c..0134d48 100644
--- a/lib/cpp/src/Thrift.h
+++ b/lib/cpp/src/Thrift.h
@@ -125,7 +125,15 @@
virtual const char* what() const throw() {
if (message_.empty()) {
- return "Default TApplicationException.";
+ switch (type_) {
+ case UNKNOWN_METHOD: return "Unknown method";
+ case INVALID_MESSAGE_TYPE: return "Invalid message type";
+ case WRONG_METHOD_NAME: return "Wrong method name";
+ case BAD_SEQUENCE_ID: return "Bad sequence identifier";
+ case MISSING_RESULT: return "Missing result";
+
+ default: return "Default TApplicationException.";
+ };
} else {
return message_.c_str();
}