Move get type name under if in http_handler_base.hpp

This commit is contained in:
sha512sum 2024-07-05 15:30:14 +00:00
parent f1501b0b17
commit 4987445511

View file

@ -23,14 +23,14 @@ struct HttpHandlerBase : ComponentBase {
try { try {
co_return co_await std::forward<Self>(self).HandleRequestThrow(std::move(request)); co_return co_await std::forward<Self>(self).HandleRequestThrow(std::move(request));
} catch(const std::exception& err) { } catch(const std::exception& err) {
auto typeName = boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name());
if(self.logging.level <= LoggingLevel::kWarning) { if(self.logging.level <= LoggingLevel::kWarning) {
self.logging.template Warning<"In handler with default name {} uncaught exception of type {}: {}">(T::kName, typeName, err.what()); self.logging.template Warning<"In handler with default name {} uncaught exception of type {}: {}">(
T::kName, boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name()), err.what());
}; };
} catch(...) { } catch(...) {
auto typeName = boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name());
if(self.logging.level <= LoggingLevel::kWarning) { if(self.logging.level <= LoggingLevel::kWarning) {
self.logging.template Warning<"In handler with default name {} uncaught exception of type {}">(T::kName, typeName); self.logging.template Warning<"In handler with default name {} uncaught exception of type {}">(
T::kName, boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name()));
}; };
}; };
co_return http::HttpResponse{.statusCode = 500, .statusMessage = "Internal Server Error", .body = "Internal Server Error"}; // NOLINT co_return http::HttpResponse{.statusCode = 500, .statusMessage = "Internal Server Error", .body = "Internal Server Error"}; // NOLINT