blob: 2268c347458e350a2438d5af2be3e7803a777ecb [file] [log] [blame]
Mark Sleef5f2be42006-09-05 21:05:31 +00001#ifndef _THRIFT_THRIFT_H_
2#define _THRIFT_THRIFT_H_ 1
Mark Sleee8540632006-05-30 09:24:40 +00003
Mark Slee8d7e1f62006-06-07 06:48:56 +00004#include <netinet/in.h>
5#include <inttypes.h>
Mark Sleee8540632006-05-30 09:24:40 +00006#include <string>
7#include <map>
8#include <list>
9#include <set>
Mark Slee4ecbebc2006-09-05 00:14:21 +000010#include <vector>
Marc Slemko5b126d62006-08-11 23:03:42 +000011#include <exception>
12
Aditya Agarwald622e962006-10-11 02:42:49 +000013#include "TLogging.h"
14
Mark Sleecfc01932006-09-01 22:18:16 +000015namespace facebook { namespace thrift {
Marc Slemko5b126d62006-08-11 23:03:42 +000016
Mark Sleeb9ff32a2006-11-16 01:00:24 +000017class TException : public std::exception {
Marc Slemko5b126d62006-08-11 23:03:42 +000018public:
Mark Sleeb9ff32a2006-11-16 01:00:24 +000019 TException() {}
20
21 TException(const std::string message) :
Mark Slee2f6404d2006-10-10 01:37:40 +000022 message_(message) {}
23
Martin Kraemer8196a612006-12-09 01:57:58 +000024 virtual ~TException() throw() {}
Mark Slee2f6404d2006-10-10 01:37:40 +000025
Martin Kraemer92a2eac2007-02-05 20:58:41 +000026 virtual const char* what() const throw() {
Mark Sleeb9ff32a2006-11-16 01:00:24 +000027 if (message_.empty()) {
28 return "Default TException.";
29 } else {
30 return message_.c_str();
31 }
Mark Slee2f6404d2006-10-10 01:37:40 +000032 }
33
Martin Kraemer92a2eac2007-02-05 20:58:41 +000034protected:
Mark Slee2abc9df2006-12-16 01:06:49 +000035 std::string message_;
Mark Slee2f6404d2006-10-10 01:37:40 +000036
Marc Slemko5b126d62006-08-11 23:03:42 +000037};
38
39}} // facebook::thrift
Mark Sleee8540632006-05-30 09:24:40 +000040
Mark Sleef5f2be42006-09-05 21:05:31 +000041#endif // #ifndef _THRIFT_THRIFT_H_