From 45248ba327bcf330fd2e49f90a59159fdf8ebecc Mon Sep 17 00:00:00 2001 From: Josh Lehan Date: Thu, 14 Jul 2022 14:03:29 -0700 Subject: bmcweb: Show exception what() before exiting Although exceptions should not happen in bmcweb, the underlying Crow code sometimes throws, and so do bugs caused by accidental usage of functions that throw. Adding e.what() output when std::exception is thrown. Tested: Accidentally tested more often than I would care to admit.... Signed-off-by: Josh Lehan Change-Id: Ifcd30dc53369708b21bf958c627755651422f18a --- src/webserver_main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp index b68e167527..05c10cc025 100644 --- a/src/webserver_main.cpp +++ b/src/webserver_main.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -158,6 +159,11 @@ int main(int /*argc*/, char** /*argv*/) { return run(); } + catch (const std::exception& e) + { + BMCWEB_LOG_CRITICAL << "Threw exception to main: " << e.what(); + return -1; + } catch (...) { BMCWEB_LOG_CRITICAL << "Threw exception to main"; -- cgit v1.2.3