From: dweatherford Date: Wed, 5 Dec 2007 03:40:19 +0000 (+0000) Subject: [thrift] Better default TApplicationException messages X-Git-Tag: 0.2.0~1089 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=2323cf642226468e6363b031fad6d9f64a45cb9f;p=common%2Fthrift.git [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 ad8d46c3..0134d48d 100644 --- a/lib/cpp/src/Thrift.h +++ b/lib/cpp/src/Thrift.h @@ -125,7 +125,15 @@ class TApplicationException : public TException { 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(); }