From e9334cb23007c5c111370ff5f5eca64e9dde5754 Mon Sep 17 00:00:00 2001 From: DavidZagury <32644413+DavidZagury@users.noreply.github.com> Date: Mon, 2 Dec 2024 19:26:50 +0200 Subject: [PATCH] Improve log information when exception is caught in Orch2 class (#3401) What I did Add the information regarding which class the exception is originated from when Orch2 catches an exception. Why I did it An Exception was thrown, and the error log given was: ERR swss#orchagent: :- doTask: Logic error: map::at This gives almost no information on where the exception happened. --- orchagent/orch.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/orchagent/orch.cpp b/orchagent/orch.cpp index 708a86280a..6c6b2afa78 100644 --- a/orchagent/orch.cpp +++ b/orchagent/orch.cpp @@ -845,19 +845,19 @@ void Orch2::doTask(Consumer &consumer) } catch (const std::invalid_argument& e) { - SWSS_LOG_ERROR("Parse error: %s", e.what()); + SWSS_LOG_ERROR("Parse error in %s: %s", typeid(*this).name(), e.what()); } catch (const std::logic_error& e) { - SWSS_LOG_ERROR("Logic error: %s", e.what()); + SWSS_LOG_ERROR("Logic error in %s: %s", typeid(*this).name(), e.what()); } catch (const std::exception& e) { - SWSS_LOG_ERROR("Exception was catched in the request parser: %s", e.what()); + SWSS_LOG_ERROR("Exception was caught in the request parser in %s: %s", typeid(*this).name(), e.what()); } catch (...) { - SWSS_LOG_ERROR("Unknown exception was catched in the request parser"); + SWSS_LOG_ERROR("Unknown exception was caught in the request parser"); } request_.clear();