Fix logging in HttpHandlerBase

This commit is contained in:
sha512sum 2024-07-03 15:24:58 +00:00
parent 71c3ab61be
commit afe0cb4729

View file

@ -24,9 +24,11 @@ struct HttpHandlerBase : ComponentBase {
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()); auto typeName = boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name());
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, typeName, err.what());
} catch(...) { } catch(...) {
auto typeName = boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name()); auto typeName = boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name());
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, typeName);
}; };
co_return http::HttpResponse{.statusCode = 500, .statusMessage = "Internal Server Error", .body = "Internal Server Error"}; co_return http::HttpResponse{.statusCode = 500, .statusMessage = "Internal Server Error", .body = "Internal Server Error"};