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