From 2323cf642226468e6363b031fad6d9f64a45cb9f Mon Sep 17 00:00:00 2001 From: dweatherford Date: Wed, 5 Dec 2007 03:40:19 +0000 Subject: [PATCH] [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 --- lib/cpp/src/Thrift.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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(); } -- 2.17.1