src: Print out exception type

This commit is contained in:
Tatsuhiro Tsujikawa 2015-10-22 01:34:01 +09:00
parent e3c95265a4
commit 20ac0e3e48
1 changed files with 2 additions and 3 deletions

View File

@ -33,6 +33,7 @@
#include <memory> #include <memory>
#include <array> #include <array>
#include <functional> #include <functional>
#include <typeinfo>
namespace nghttp2 { namespace nghttp2 {
@ -205,9 +206,7 @@ inline int run_app(std::function<int(int, char **)> app, int argc,
} catch (const std::bad_alloc &) { } catch (const std::bad_alloc &) {
fputs("Out of memory\n", stderr); fputs("Out of memory\n", stderr);
} catch (const std::exception &x) { } catch (const std::exception &x) {
fputs("Exception caught: ", stderr); fprintf(stderr, "Caught %s:\n%s\n", typeid(x).name(), x.what());
fputs(x.what(), stderr);
fputs("\n", stderr);
} catch (...) { } catch (...) {
fputs("Unknown exception caught\n", stderr); fputs("Unknown exception caught\n", stderr);
} }