summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/cgi/p2webMain.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/project2/cgi/p2webMain.cpp b/project2/cgi/p2webMain.cpp
index 25a4300..bce54fa 100644
--- a/project2/cgi/p2webMain.cpp
+++ b/project2/cgi/p2webMain.cpp
@@ -1,4 +1,5 @@
#include <libxml/tree.h>
+#include <glibmm/exception.h>
#include <cgicc/Cgicc.h>
#include <cgicc/CgiEnvironment.h>
#include <cgicc/HTTPContentHeader.h>
@@ -10,6 +11,7 @@ FILE * realstdout = stdout;
#include <boost/bind.hpp>
#include <syslog.h>
#include "FCgiIO.h"
+#include <cxxabi.h>
int
xmlWrite(void * _out, const char * buf, int len)
@@ -71,10 +73,22 @@ int main(void)
catch (const std::exception & e) {
cgicc::HTTPStatusHeader header(500, e.what());
header.render(IO);
+ char * buf = __cxxabiv1::__cxa_demangle(typeid(e).name(), NULL, NULL, NULL);
IO << "Kaboom!" << std::endl
<< std::endl
- << typeid(e).name() << std::endl
+ << buf << std::endl
<< e.what() << std::endl;
+ free(buf);
+ }
+ catch (const Glib::Exception & e) {
+ cgicc::HTTPStatusHeader header(500, e.what());
+ header.render(IO);
+ char * buf = __cxxabiv1::__cxa_demangle(typeid(e).name(), NULL, NULL, NULL);
+ IO << "Kaboom!" << std::endl
+ << std::endl
+ << buf << std::endl
+ << e.what() << std::endl;
+ free(buf);
}
catch (...) {
cgicc::HTTPStatusHeader header(500, "Unknown exception");
@@ -82,6 +96,7 @@ int main(void)
IO << "Kaboom!" << std::endl
<< std::endl
<< "Unknown exception." << std::endl;
+ throw;
}
alarm(60);
LoaderBase::onIteration();