diff options
author | Ed Tanous <edtanous@google.com> | 2023-05-30 23:00:57 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-06-29 23:22:20 +0300 |
commit | f706551d13f2e01b7e81fc7113c91efd253f315e (patch) | |
tree | d0700d3da02e8d94a1e9c9f30f4ffd64d9e0fb64 /src | |
parent | d8139c683a2f42c47ed913b731becc6cd681e2dd (diff) | |
download | bmcweb-f706551d13f2e01b7e81fc7113c91efd253f315e.tar.xz |
Provide bmcweb-specific bmcweb exception handler
Providing our own boost exception handler, this has the benefits of:
1. Not generating the unwind stacks in the binary, which saves about 1%
on the total compressed binary size.
2. Allows us to start burning down all the places where we incorrectly
call boost methods that throw exceptions. Throwing exceptions to
master has caused exceptions in the past.
Tested:
No good way to test exceptional cases. Code inspection and compilation
only.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I0037ff72d09fd538543882dff771c3193a293e9f
Diffstat (limited to 'src')
-rw-r--r-- | src/boost_asio.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/boost_asio.cpp b/src/boost_asio.cpp index bf00c8ff26..53f2fd6945 100644 --- a/src/boost_asio.cpp +++ b/src/boost_asio.cpp @@ -1 +1,22 @@ +#include "logging.hpp" + #include <boost/asio/impl/src.hpp> +#include <boost/assert/source_location.hpp> + +#include <exception> + +namespace boost +{ +void throw_exception(const std::exception& e) +{ + BMCWEB_LOG_CRITICAL << "Boost exception thrown " << e.what(); + std::terminate(); +} + +void throw_exception(const std::exception& e, const source_location& loc) +{ + BMCWEB_LOG_CRITICAL << "Boost exception thrown " << e.what() << " from " + << loc; + std::terminate(); +} +} // namespace boost |