Skip to content

Commit 227d1d6

Browse files
DavidZagurymssonicbld
authored andcommitted
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.
1 parent 93c32ea commit 227d1d6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

orchagent/orch.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -845,19 +845,19 @@ void Orch2::doTask(Consumer &consumer)
845845
}
846846
catch (const std::invalid_argument& e)
847847
{
848-
SWSS_LOG_ERROR("Parse error: %s", e.what());
848+
SWSS_LOG_ERROR("Parse error in %s: %s", typeid(*this).name(), e.what());
849849
}
850850
catch (const std::logic_error& e)
851851
{
852-
SWSS_LOG_ERROR("Logic error: %s", e.what());
852+
SWSS_LOG_ERROR("Logic error in %s: %s", typeid(*this).name(), e.what());
853853
}
854854
catch (const std::exception& e)
855855
{
856-
SWSS_LOG_ERROR("Exception was catched in the request parser: %s", e.what());
856+
SWSS_LOG_ERROR("Exception was caught in the request parser in %s: %s", typeid(*this).name(), e.what());
857857
}
858858
catch (...)
859859
{
860-
SWSS_LOG_ERROR("Unknown exception was catched in the request parser");
860+
SWSS_LOG_ERROR("Unknown exception was caught in the request parser");
861861
}
862862
request_.clear();
863863

0 commit comments

Comments
 (0)