diff options
-rw-r--r-- | icespider/core/core.cpp | 7 | ||||
-rw-r--r-- | icespider/unittests/testApp.cpp | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/icespider/core/core.cpp b/icespider/core/core.cpp index d63464e..057faa6 100644 --- a/icespider/core/core.cpp +++ b/icespider/core/core.cpp @@ -4,6 +4,7 @@ #include <Ice/ObjectAdapter.h> #include <boost/filesystem/convenience.hpp> #include <factory.impl.h> +#include <compileTimeFormatter.h> INSTANTIATEFACTORY(IceSpider::Plugin, Ice::CommunicatorPtr, Ice::PropertiesPtr); INSTANTIATEPLUGINOF(IceSpider::ErrorHandler); @@ -105,15 +106,17 @@ namespace IceSpider { defaultErrorReport(request, exception); } + AdHocFormatter(LogExp, "Exception type: %?\nDetail: %?\n"); void Core::defaultErrorReport(IHttpRequest * request, const std::exception & exception) const { char * buf = __cxxabiv1::__cxa_demangle(typeid(exception).name(), NULL, NULL, NULL); request->setHeader("Content-Type", "text/plain"); request->response(500, buf); - free(buf); - request->getOutputStream() << exception.what(); + LogExp::write(request->getOutputStream(), buf, exception.what()); request->dump(std::cerr); + LogExp::write(std::cerr, buf, exception.what()); + free(buf); } Ice::ObjectPrx diff --git a/icespider/unittests/testApp.cpp b/icespider/unittests/testApp.cpp index 5832595..9714d33 100644 --- a/icespider/unittests/testApp.cpp +++ b/icespider/unittests/testApp.cpp @@ -527,7 +527,7 @@ BOOST_AUTO_TEST_CASE( testErrorHandler_Unhandled ) BOOST_REQUIRE_EQUAL(h["Content-Type"], "text/plain"); auto & o = requestDeleteItem.output; auto b = o.str().substr(o.tellg()); - BOOST_REQUIRE_EQUAL(b, "test error"); + BOOST_REQUIRE_EQUAL(b, "Exception type: TestIceSpider::Ex\nDetail: test error\n"); } BOOST_AUTO_TEST_CASE( testErrorHandler_Handled1 ) |