exception: catch by reference
`catch` should always be done by reference to avoid object slicing and
excess copy-constructor calls. Preference is for exceptions to also
be caught 'const'. (Both of these come from the C++ Core Guidelines)
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic8cd1e138220e501699525e9c8d53cd581e2598c
diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp
index 3bf8469..f8d5142 100644
--- a/ipmbbridged.cpp
+++ b/ipmbbridged.cpp
@@ -541,7 +541,7 @@
{
ipmbBusId = std::stoi(busStr);
}
- catch (std::invalid_argument)
+ catch (const std::invalid_argument &)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmbChannelInit: invalid bus id in slave-path config");
@@ -833,13 +833,13 @@
}
}
}
- catch (nlohmann::json::exception &e)
+ catch (const nlohmann::json::exception &e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"initializeChannels: Error parsing config file");
return -1;
}
- catch (std::out_of_range &e)
+ catch (const std::out_of_range &e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"initializeChannels: Error invalid type");