Skip to content

Commit

Permalink
Improve log information when exception is caught in Orch2 class (#3401)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DavidZagury authored and mssonicbld committed Dec 24, 2024
1 parent 93c32ea commit 227d1d6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions orchagent/orch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 227d1d6

Please sign in to comment.