Thrift: Fix dangling pointer errors and make messages a bit more uniform.
Reviewed By: mcslee
Test Plan: Honestly, just built the library.
Revert Plan: ok
Other Notes:
Thanks to Ben Maurer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665392 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/Thrift.h b/lib/cpp/src/Thrift.h
index 0134d48..338dbde 100644
--- a/lib/cpp/src/Thrift.h
+++ b/lib/cpp/src/Thrift.h
@@ -126,13 +126,13 @@
virtual const char* what() const throw() {
if (message_.empty()) {
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.";
+ case UNKNOWN : return "TApplicationException: Unknown application exception";
+ case UNKNOWN_METHOD : return "TApplicationException: Unknown method";
+ case INVALID_MESSAGE_TYPE : return "TApplicationException: Invalid message type";
+ case WRONG_METHOD_NAME : return "TApplicationException: Wrong method name";
+ case BAD_SEQUENCE_ID : return "TApplicationException: Bad sequence identifier";
+ case MISSING_RESULT : return "TApplicationException: Missing result";
+ default : return "TApplicationException: (Invalid exception type)";
};
} else {
return message_.c_str();