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 | |||||
Mark Slee | b9ff32a | 2006-11-16 01:00:24 +0000 | [diff] [blame^] | 24 | ~TException() throw() {} |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 25 | |
26 | const char* what() { | ||||
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 | |||||
34 | private: | ||||
35 | const std::string message_; | ||||
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_ |