src: Print out exception type
This commit is contained in:
parent
e3c95265a4
commit
20ac0e3e48
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue