Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 1 | #ifndef _THRIFT_THRIFT_H_ |
2 | #define _THRIFT_THRIFT_H_ 1 | ||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 3 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 4 | #include <netinet/in.h> |
5 | #include <inttypes.h> | ||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 6 | #include <string> |
7 | #include <map> | ||||
8 | #include <list> | ||||
9 | #include <set> | ||||
Mark Slee | 4ecbebc | 2006-09-05 00:14:21 +0000 | [diff] [blame] | 10 | #include <vector> |
Marc Slemko | 5b126d6 | 2006-08-11 23:03:42 +0000 | [diff] [blame] | 11 | #include <exception> |
12 | |||||
Aditya Agarwal | d622e96 | 2006-10-11 02:42:49 +0000 | [diff] [blame] | 13 | #include "TLogging.h" |
14 | |||||
Mark Slee | cfc0193 | 2006-09-01 22:18:16 +0000 | [diff] [blame] | 15 | namespace facebook { namespace thrift { |
Marc Slemko | 5b126d6 | 2006-08-11 23:03:42 +0000 | [diff] [blame] | 16 | |
Mark Slee | b9ff32a | 2006-11-16 01:00:24 +0000 | [diff] [blame] | 17 | class TException : public std::exception { |
Marc Slemko | 5b126d6 | 2006-08-11 23:03:42 +0000 | [diff] [blame] | 18 | public: |
Mark Slee | b9ff32a | 2006-11-16 01:00:24 +0000 | [diff] [blame] | 19 | TException() {} |
20 | |||||
21 | TException(const std::string message) : | ||||
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 22 | message_(message) {} |
23 | |||||
Martin Kraemer | 8196a61 | 2006-12-09 01:57:58 +0000 | [diff] [blame] | 24 | virtual ~TException() throw() {} |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 25 | |
Martin Kraemer | 92a2eac | 2007-02-05 20:58:41 +0000 | [diff] [blame^] | 26 | virtual const char* what() const throw() { |
Mark Slee | b9ff32a | 2006-11-16 01:00:24 +0000 | [diff] [blame] | 27 | if (message_.empty()) { |
28 | return "Default TException."; | ||||
29 | } else { | ||||
30 | return message_.c_str(); | ||||
31 | } | ||||
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 32 | } |
33 | |||||
Martin Kraemer | 92a2eac | 2007-02-05 20:58:41 +0000 | [diff] [blame^] | 34 | protected: |
Mark Slee | 2abc9df | 2006-12-16 01:06:49 +0000 | [diff] [blame] | 35 | std::string message_; |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 36 | |
Marc Slemko | 5b126d6 | 2006-08-11 23:03:42 +0000 | [diff] [blame] | 37 | }; |
38 | |||||
39 | }} // facebook::thrift | ||||
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 40 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 41 | #endif // #ifndef _THRIFT_THRIFT_H_ |