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/Msg.h"
00027
00028 #include <memory>
00029 #include <string>
00030
00031 namespace qpid
00032 {
00033
00035 std::string strError(int err);
00036
00040 class Exception : public std::exception
00041 {
00042 public:
00043 explicit Exception(const std::string& message=std::string()) throw();
00044 virtual ~Exception() throw();
00045 virtual const char* what() const throw();
00046
00047 protected:
00048 std::string getPrefix() const;
00049 private:
00050 std::string message;
00051 mutable std::string whatStr;
00052 };
00053
00063 struct SessionException : public Exception {
00064 const framing::ReplyCode code;
00065 SessionException(framing::ReplyCode code_, const std::string& message)
00066 : Exception(message), code(code_) {}
00067 };
00068
00069 struct ChannelException : public SessionException {
00070 ChannelException(framing::ReplyCode code, const std::string& message)
00071 : SessionException(code, message) {}
00072 };
00073
00074 struct ConnectionException : public SessionException {
00075 ConnectionException(framing::ReplyCode code, const std::string& message)
00076 : SessionException(code, message) {}
00077 };
00078
00079 struct ClosedException : public Exception {
00080 ClosedException(const std::string& msg=std::string());
00081 std::string getPrefix() const;
00082 };
00083
00084 }
00085
00086 #endif