summaryrefslogtreecommitdiff
path: root/src/HttpServer.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-21 13:27:53 -0800
committerPixel <pixel@nobis-crew.org>2011-11-21 13:27:53 -0800
commite10639753d7dbd368f5edc2555d75c4b5905ba3b (patch)
tree34b6c4bc2990f48de30d26486426558d643e7ac8 /src/HttpServer.cc
parent071e7f07901309a38c8cb5311aaecaa46c0c3542 (diff)
GeneralException() will now trace the callstack and store this, for debugging purposes.
Diffstat (limited to 'src/HttpServer.cc')
-rw-r--r--src/HttpServer.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/HttpServer.cc b/src/HttpServer.cc
index 18dc6c8..7df6406 100644
--- a/src/HttpServer.cc
+++ b/src/HttpServer.cc
@@ -7,6 +7,7 @@ class OutputCheck : public Balau::Handle {
public:
OutputCheck(Balau::IO<Balau::Handle> h) : m_h(h), m_wrote(false) { Assert(m_h->canWrite()); m_name.set("OutputCheck(%s)", m_h->getName()); }
virtual void close() throw (Balau::GeneralException) { m_h->close(); }
+ virtual bool isClosed() { return m_h->isClosed(); }
virtual bool isEOF() { return m_h->isEOF(); }
virtual bool canWrite() { return true; }
virtual const char * getName() { return m_name.to_charp(); }
@@ -429,7 +430,7 @@ bool Balau::HttpWorker::handleClient() {
HttpServer::ActionFound f = m_server->findAction(uri.to_charp(), host.to_charp());
if (f.first) {
- IO<OutputCheck> out(m_socket);
+ IO<OutputCheck> out(new OutputCheck(m_socket));
Http::Request req;
req.method = method;
req.host = host;
@@ -443,13 +444,16 @@ bool Balau::HttpWorker::handleClient() {
persistent = false;
}
catch (GeneralException e) {
- Balau::Printer::elog(Balau::E_HTTPSERVER, "%s got an exception while processing its request: `%s'", m_name.to_charp(), e.getMsg());
+ Printer::log(M_ERROR, "%s got an exception while processing its request: `%s'", m_name.to_charp(), e.getMsg());
+ std::vector<String> trace = e.getTrace();
+ for (std::vector<String>::iterator i = trace.begin(); i != trace.end(); i++)
+ Printer::log(M_DEBUG, "%s", i->to_charp());
if (!out->wrote())
send500(e.getMsg());
return false;
}
catch (...) {
- Balau::Printer::elog(Balau::E_HTTPSERVER, "%s got an un unknow exception while processing its request: `%s'", m_name.to_charp());
+ Printer::log(M_ERROR, "%s got an unknow exception while processing its request: `%s'", m_name.to_charp());
if (!out->wrote())
send500("unknow exception");
return false;