00001 #ifndef __QpidError__
00002 #define __QpidError__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <string>
00024 #include <memory>
00025 #include <ostream>
00026 #include <Exception.h>
00027
00028 namespace qpid {
00029
00030 struct SrcLine {
00031 public:
00032 SrcLine(const std::string& file_="", int line_=0) :
00033 file(file_), line(line_) {}
00034
00035 std::string file;
00036 int line;
00037 };
00038
00039 class QpidError : public Exception {
00040 public:
00041 const int code;
00042 const std::string msg;
00043 const SrcLine location;
00044
00045 QpidError();
00046 QpidError(int _code, const std::string& _msg, const SrcLine& _loc) throw();
00047 ~QpidError() throw();
00048 Exception* clone() const throw();
00049 void throwSelf() const;
00050 };
00051
00052
00053 }
00054
00055 #define SRCLINE ::qpid::SrcLine(__FILE__, __LINE__)
00056
00057 #define QPID_ERROR(CODE, MESSAGE) ::qpid::QpidError((CODE), (MESSAGE), SRCLINE)
00058
00059 #define THROW_QPID_ERROR(CODE, MESSAGE) throw QPID_ERROR(CODE,MESSAGE)
00060
00061 const int PROTOCOL_ERROR = 10000;
00062 const int APR_ERROR = 20000;
00063 const int FRAMING_ERROR = 30000;
00064 const int CLIENT_ERROR = 40000;
00065 const int INTERNAL_ERROR = 50000;
00066
00067 #endif