diff options
Diffstat (limited to 'cpp/lib/common/QpidError.h')
-rw-r--r-- | cpp/lib/common/QpidError.h | 19 |
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(); }; |