diff options
author | Vincent Richard <[email protected]> | 2009-12-01 14:24:55 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2009-12-01 14:24:55 +0000 |
commit | 82e1a690d97cd9d9f392beccbb6b1d35f3573f08 (patch) | |
tree | bf6097c08872b3404771e7a92fff7be3d6e1ee00 /tests/testUtils.cpp | |
parent | Added option to return ISO week-numbering instead of default calendar-numbering. (diff) | |
download | vmime-82e1a690d97cd9d9f392beccbb6b1d35f3573f08.tar.gz vmime-82e1a690d97cd9d9f392beccbb6b1d35f3573f08.zip |
Fixed directory renaming.
Diffstat (limited to 'tests/testUtils.cpp')
-rw-r--r-- | tests/testUtils.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp index ee17c923..36455cff 100644 --- a/tests/testUtils.cpp +++ b/tests/testUtils.cpp @@ -187,3 +187,61 @@ vmime::ref <vmime::net::timeoutHandler> testTimeoutHandlerFactory::create() return vmime::create <testTimeoutHandler>(); } + + +// Exception helper +std::ostream& operator<<(std::ostream& os, const vmime::exception& e) +{ + os << "* vmime::exceptions::" << e.name() << std::endl; + os << " what = " << e.what() << std::endl; + + // More information for special exceptions + if (dynamic_cast <const vmime::exceptions::command_error*>(&e)) + { + const vmime::exceptions::command_error& cee = + dynamic_cast <const vmime::exceptions::command_error&>(e); + + os << " command = " << cee.command() << std::endl; + os << " response = " << cee.response() << std::endl; + } + + if (dynamic_cast <const vmime::exceptions::invalid_response*>(&e)) + { + const vmime::exceptions::invalid_response& ir = + dynamic_cast <const vmime::exceptions::invalid_response&>(e); + + os << " response = " << ir.response() << std::endl; + } + + if (dynamic_cast <const vmime::exceptions::connection_greeting_error*>(&e)) + { + const vmime::exceptions::connection_greeting_error& cgee = + dynamic_cast <const vmime::exceptions::connection_greeting_error&>(e); + + os << " response = " << cgee.response() << std::endl; + } + + if (dynamic_cast <const vmime::exceptions::authentication_error*>(&e)) + { + const vmime::exceptions::authentication_error& aee = + dynamic_cast <const vmime::exceptions::authentication_error&>(e); + + os << " response = " << aee.response() << std::endl; + } + + if (dynamic_cast <const vmime::exceptions::filesystem_exception*>(&e)) + { + const vmime::exceptions::filesystem_exception& fse = + dynamic_cast <const vmime::exceptions::filesystem_exception&>(e); + + os << " path = " << vmime::platform::getHandler()-> + getFileSystemFactory()->pathToString(fse.path()) << std::endl; + } + + if (e.other() != NULL) + os << *e.other(); + + return os; +} + + |