diff options
author | Andrew Stitcher <astitcher@apache.org> | 2007-06-18 12:11:32 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2007-06-18 12:11:32 +0000 |
commit | 45b526ce09daee869ec1313808583f7e05bff7bb (patch) | |
tree | 297d2b1f02b14e1fdffbc1074b3d23670859f602 /cpp/src/qpid/Exception.cpp | |
parent | 41c30308ad435c338633b97405fe7350d515f069 (diff) | |
download | qpid-python-45b526ce09daee869ec1313808583f7e05bff7bb.tar.gz |
Intermediate checkin with preliminary work on epoll based net IO
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@548337 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/Exception.cpp')
-rw-r--r-- | cpp/src/qpid/Exception.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cpp/src/qpid/Exception.cpp b/cpp/src/qpid/Exception.cpp index f4eeb7931b..7e34e49bef 100644 --- a/cpp/src/qpid/Exception.cpp +++ b/cpp/src/qpid/Exception.cpp @@ -42,13 +42,15 @@ Exception::Exception(const std::string& str) throw() Exception::Exception(const char* str) throw() : whatStr(str) { ctorLog(this); } +Exception::Exception(const std::exception& e) throw() : whatStr(e.what()) {} + Exception::~Exception() throw() {} const char* Exception::what() const throw() { return whatStr.c_str(); } std::string Exception::toString() const throw() { return whatStr; } -Exception* Exception::clone() const throw() { return new Exception(*this); } +Exception::auto_ptr Exception::clone() const throw() { return Exception::auto_ptr(new Exception(*this)); } void Exception::throwSelf() const { throw *this; } @@ -56,4 +58,18 @@ ShutdownException::ShutdownException() : Exception("Shut down.") {} EmptyException::EmptyException() : Exception("Empty.") {} +const char* Exception::defaultMessage = "Unexpected exception"; + +void Exception::log(const char* what, const char* message) { + QPID_LOG(error, message << ": " << what); +} + +void Exception::log(const std::exception& e, const char* message) { + log(e.what(), message); +} + +void Exception::logUnknown(const char* message) { + log("unknown exception.", message); +} + } // namespace qpid |