00001 #ifndef _Exception_
00002 #define _Exception_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "qpid/framing/amqp_types.h"
00026 #include "qpid/framing/constants.h"
00027 #include "qpid/Msg.h"
00028
00029 #include <memory>
00030 #include <string>
00031
00032 namespace qpid
00033 {
00034
00036 std::string strError(int err);
00037
00041 class Exception : public std::exception
00042 {
00043 public:
00044 explicit Exception(const std::string& message=std::string()) throw();
00045 virtual ~Exception() throw();
00046 virtual const char* what() const throw();
00047 virtual std::string getMessage() const;
00048 virtual std::string getPrefix() const;
00049
00050 private:
00051 std::string message;
00052 mutable std::string whatStr;
00053 };
00054
00055 struct SessionException : public Exception {
00056 const framing::ReplyCode code;
00057 SessionException(framing::ReplyCode code_, const std::string& message)
00058 : Exception(message), code(code_) {}
00059 };
00060
00061 struct ChannelException : public Exception {
00062 const framing::ReplyCode code;
00063 ChannelException(framing::ReplyCode _code, const std::string& message)
00064 : Exception(message), code(_code) {}
00065 };
00066
00067 struct ConnectionException : public Exception {
00068 const framing::ReplyCode code;
00069 ConnectionException(framing::ReplyCode _code, const std::string& message)
00070 : Exception(message), code(_code) {}
00071 };
00072
00073 struct ClosedException : public Exception {
00074 ClosedException(const std::string& msg=std::string());
00075 std::string getPrefix() const;
00076 };
00077
00078 }
00079
00080 #endif