summaryrefslogtreecommitdiff
path: root/cpp/lib/common/QpidError.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-01-31 19:07:04 +0000
committerAlan Conway <aconway@apache.org>2007-01-31 19:07:04 +0000
commit9cdf50e9bbf4aae222600245691f9b1d3acb3147 (patch)
tree0784a9860824c0d144e1615ad1f655ac2dea5916 /cpp/lib/common/QpidError.h
parent754f8903943233604661b91b53defe39120e6ad5 (diff)
downloadqpid-python-9cdf50e9bbf4aae222600245691f9b1d3acb3147.tar.gz
* framing/ChannelAdapter.cpp: Enable channel state assertions.
* common/Exception & others: Exception template constructors that accept any object that supports ostream operator<< as messages. E.g. can pass a boost::format object directly, no need to call str(). * Fixed up various exception messges to use boost::format. * framing/Requester.cpp: Exception on invalid response id. * client/Connection.h: Remove extra getVersion() function. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@501948 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/common/QpidError.h')
-rw-r--r--cpp/lib/common/QpidError.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/cpp/lib/common/QpidError.h b/cpp/lib/common/QpidError.h
index 30d9d27076..2a0395ab79 100644
--- a/cpp/lib/common/QpidError.h
+++ b/cpp/lib/common/QpidError.h
@@ -23,6 +23,7 @@
#include <string>
#include <memory>
#include <ostream>
+
#include <Exception.h>
namespace qpid {
@@ -36,17 +37,27 @@ struct SrcLine {
int line;
};
-class QpidError : public Exception {
+class QpidError : public Exception
+{
public:
const int code;
- const std::string msg;
- const SrcLine location;
+ SrcLine loc;
+ std::string msg;
QpidError();
- QpidError(int _code, const std::string& _msg, const SrcLine& _loc) throw();
+
+ template <class T>
+ QpidError(int code_, const T& msg_, const SrcLine& loc_) throw()
+ : code(code_), loc(loc_), msg(boost::lexical_cast<std::string>(msg_))
+ { init(); }
+
~QpidError() throw();
Exception* clone() const throw();
void throwSelf() const;
+
+ private:
+
+ void init();
};