diff options
| author | Alan Conway <aconway@apache.org> | 2008-02-22 19:14:05 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-02-22 19:14:05 +0000 |
| commit | 0375ee9a77888a4901dcb093af1683c953cfcb37 (patch) | |
| tree | 047415b956f968f4610f6c0d9156a82c10d27400 /cpp/src/qpid/Exception.h | |
| parent | baf3d1551e30c0a522a52837c84b3b7c1c411aa0 (diff) | |
| download | qpid-python-0375ee9a77888a4901dcb093af1683c953cfcb37.tar.gz | |
Provide separate name, message and error code on all Exceptions.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@630296 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/Exception.h')
| -rw-r--r-- | cpp/src/qpid/Exception.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/cpp/src/qpid/Exception.h b/cpp/src/qpid/Exception.h index 57c7a21234..00365018ba 100644 --- a/cpp/src/qpid/Exception.h +++ b/cpp/src/qpid/Exception.h @@ -40,13 +40,27 @@ std::string strError(int err); class Exception : public std::exception { public: - explicit Exception(const std::string& str=std::string()) throw(); + explicit Exception(const std::string& message=std::string(), + const std::string& name=std::string(), + uint16_t code=0) throw(); + virtual ~Exception() throw(); + + // returns "name: message" + virtual const char* what() const throw(); + + virtual std::string getName() const throw(); + virtual std::string getMessage() const throw(); + virtual uint16_t getCode() const throw(); + + // FIXME aconway 2008-02-21: backwards compat, remove? + std::string str() const throw() { return getMessage(); } - virtual const char *what() const throw(); - virtual std::string str() const throw(); private: - std::string msg; + const std::string message; + const std::string name; + const uint16_t code; + const std::string whatStr; }; struct ChannelException : public Exception { @@ -62,8 +76,7 @@ struct ConnectionException : public Exception { }; struct ClosedException : public Exception { - static const std::string CLOSED_MESSAGE; - ClosedException(const std::string& msg=CLOSED_MESSAGE) : Exception(msg) {} + ClosedException(const std::string& msg=std::string()); }; } // namespace qpid |
