dbms: fixed error [#CONV-6757].

This commit is contained in:
Alexey Milovidov 2013-02-16 13:14:41 +00:00
parent 1f92a0498e
commit 743108b25e

View File

@ -144,39 +144,39 @@ void HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Ne
catch (DB::Exception & e) catch (DB::Exception & e)
{ {
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR); response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
std::ostream & ostr = response.send();
std::stringstream s; std::stringstream s;
s << "Code: " << e.code() s << "Code: " << e.code()
<< ", e.displayText() = " << e.displayText() << ", e.what() = " << e.what(); << ", e.displayText() = " << e.displayText() << ", e.what() = " << e.what();
ostr << s.str() << std::endl; if (!response.sent())
response.send() << s.str() << std::endl;
LOG_ERROR(log, s.str()); LOG_ERROR(log, s.str());
} }
catch (Poco::Exception & e) catch (Poco::Exception & e)
{ {
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR); response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
std::ostream & ostr = response.send();
std::stringstream s; std::stringstream s;
s << "Code: " << ErrorCodes::POCO_EXCEPTION << ", e.code() = " << e.code() s << "Code: " << ErrorCodes::POCO_EXCEPTION << ", e.code() = " << e.code()
<< ", e.displayText() = " << e.displayText() << ", e.what() = " << e.what(); << ", e.displayText() = " << e.displayText() << ", e.what() = " << e.what();
ostr << s.str() << std::endl; if (!response.sent())
response.send() << s.str() << std::endl;
LOG_ERROR(log, s.str()); LOG_ERROR(log, s.str());
} }
catch (std::exception & e) catch (std::exception & e)
{ {
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR); response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
std::ostream & ostr = response.send();
std::stringstream s; std::stringstream s;
s << "Code: " << ErrorCodes::STD_EXCEPTION << ". " << e.what(); s << "Code: " << ErrorCodes::STD_EXCEPTION << ". " << e.what();
ostr << s.str() << std::endl; if (!response.sent())
response.send() << s.str() << std::endl;
LOG_ERROR(log, s.str()); LOG_ERROR(log, s.str());
} }
catch (...) catch (...)
{ {
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR); response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
std::ostream & ostr = response.send();
std::stringstream s; std::stringstream s;
s << "Code: " << ErrorCodes::UNKNOWN_EXCEPTION << ". Unknown exception."; s << "Code: " << ErrorCodes::UNKNOWN_EXCEPTION << ". Unknown exception.";
ostr << s.str() << std::endl; if (!response.sent())
response.send() << s.str() << std::endl;
LOG_ERROR(log, s.str()); LOG_ERROR(log, s.str());
} }
} }