diff options
author | Josh Lehan <krellan@google.com> | 2022-07-15 00:03:29 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-07-25 19:10:53 +0300 |
commit | 45248ba327bcf330fd2e49f90a59159fdf8ebecc (patch) | |
tree | 044ad53363e918d1a363c82c2e7a9474e1717824 | |
parent | 59d494ee9608850f17bd7f4644838c26daab2669 (diff) | |
download | bmcweb-45248ba327bcf330fd2e49f90a59159fdf8ebecc.tar.xz |
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 <krellan@google.com>
Change-Id: Ifcd30dc53369708b21bf958c627755651422f18a
-rw-r--r-- | src/webserver_main.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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 <vm_websocket.hpp> #include <webassets.hpp> +#include <exception> #include <memory> #include <string> @@ -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"; |