From 4987445511d9126e7746351b59766229d815a8b4 Mon Sep 17 00:00:00 2001 From: sha512sum Date: Fri, 5 Jul 2024 15:30:14 +0000 Subject: [PATCH] Move get type name under if in http_handler_base.hpp --- include/cserver/server/handlers/http_handler_base.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/cserver/server/handlers/http_handler_base.hpp b/include/cserver/server/handlers/http_handler_base.hpp index f2ee457..7e9da37 100644 --- a/include/cserver/server/handlers/http_handler_base.hpp +++ b/include/cserver/server/handlers/http_handler_base.hpp @@ -23,14 +23,14 @@ struct HttpHandlerBase : ComponentBase { try { co_return co_await std::forward(self).HandleRequestThrow(std::move(request)); } catch(const std::exception& err) { - 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, boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name()), err.what()); }; } catch(...) { - 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, boost::core::demangle(__cxxabiv1::__cxa_current_exception_type()->name())); }; }; co_return http::HttpResponse{.statusCode = 500, .statusMessage = "Internal Server Error", .body = "Internal Server Error"}; // NOLINT