From c8491cb0b416637f1c1119c3f0d95500a4bd9c29 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Mon, 6 May 2024 18:14:55 -0700 Subject: Move under exception handler Static analysis still sometimes flags that this throws, even through clang-tidy doesn't. Move it under the exception handler. Tested: Logging still works. Change-Id: I67425749b97b0a259746840c7b9a9b4834dfe52e Signed-off-by: Ed Tanous --- http/logging.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'http') diff --git a/http/logging.hpp b/http/logging.hpp index 4b9eab967c..768014a3b9 100644 --- a/http/logging.hpp +++ b/http/logging.hpp @@ -79,13 +79,14 @@ inline void vlog(std::format_string&& format, Args&&... args, std::string_view filename = loc.file_name(); filename = filename.substr(filename.rfind('/') + 1); std::string logLocation; - logLocation = std::format("[{} {}:{}] ", levelString, filename, loc.line()); try { // TODO, multiple static analysis tools flag that this could potentially // throw Based on the documentation, it shouldn't throw, so long as none // of the formatters throw, so unclear at this point why this try/catch // is required, but add it to silence the static analysis tools. + logLocation = std::format("[{} {}:{}] ", levelString, filename, + loc.line()); logLocation += std::format(std::move(format), std::forward(args)...); } -- cgit v1.2.3