catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia9932efb6a9335e80b3f2376d2d62e1b65866f44
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 89269cd..deecca7 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -156,7 +156,7 @@
serial = result;
return 0;
}
- catch (std::bad_variant_access& e)
+ catch (const std::bad_variant_access& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return -1;
@@ -244,7 +244,7 @@
bmcResetDisablesIntf, "ResetOnSMI",
!disableResetOnSMI);
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Failed to set BMC reset disables",
@@ -272,7 +272,7 @@
bmcResetDisablesIntf, "ResetOnSMI");
disableResetOnSMI = !std::get<bool>(variant);
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Failed to get BMC reset disables",
@@ -412,7 +412,7 @@
(readBuf.begin()));
return ipmi::responseSuccess(readBuf);
}
- catch (std::bad_variant_access& e)
+ catch (const std::bad_variant_access& e)
{
return ipmi::responseUnspecifiedError();
}
@@ -838,7 +838,7 @@
static_cast<uint8_t>(0));
}
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Failed to set processor error config",
@@ -903,7 +903,7 @@
// policy is only supported on node 3/4
resp->policySupport = shutdownPolicySupported;
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.description());
return IPMI_CC_UNSPECIFIED_ERROR;
@@ -963,7 +963,7 @@
oemShutdownPolicyObjPathProp,
sdbusplus::com::intel::Control::server::convertForMessage(policy));
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.description());
return IPMI_CC_UNSPECIFIED_ERROR;
@@ -1001,7 +1001,7 @@
return false;
}
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.description());
return true;
@@ -1038,7 +1038,7 @@
return false;
}
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.description());
return true;
@@ -1067,7 +1067,7 @@
{
getChannelInfo(channel, chInfo);
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMSetUser2Activation: Failed to get Channel Info",
@@ -1216,7 +1216,7 @@
{
getChannelInfo(ctx->channel, chInfo);
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMSetSpecialUserPassword: Failed to get Channel Info",
@@ -1315,7 +1315,7 @@
sdbusplus::xyz::openbmc_project::Led::server::Physical::
convertActionFromString(strState));
}
- catch (sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return -1;
@@ -1490,7 +1490,7 @@
auto data = bus.call(call);
data.read(resp);
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"getFanProfileInterface: can't get thermal mode!",
@@ -1581,7 +1581,7 @@
setDbusProperty(*dbus, settingsBusName, thermalModePath,
thermalModeInterface, "Current", mode);
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMSetFanConfig: can't set thermal mode!",
@@ -1672,7 +1672,7 @@
auto reply = dbus->call(method);
reply.read(resp);
}
- catch (sdbusplus::exception_t&)
+ catch (const sdbusplus::exception_t&)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMGetFscParameter: mapper error");
@@ -1706,7 +1706,7 @@
auto reply = dbus->call(method);
reply.read(resp);
}
- catch (sdbusplus::exception_t&)
+ catch (const sdbusplus::exception_t&)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"getFanConfigPaths: mapper error");
@@ -1724,7 +1724,7 @@
getAllDbusProperties(*dbus, objects[0].first, path,
pidConfigurationIface));
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"getPidConfigs: can't get DbusProperties!",
@@ -1881,7 +1881,7 @@
cfmLimitIface, "Limit",
static_cast<double>(cfm));
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMSetFscParameter: can't set cfm setting!",
@@ -2070,7 +2070,7 @@
*dbus, "xyz.openbmc_project.ExitAirTempSensor",
"/xyz/openbmc_project/control/MaxCFM", cfmLimitIface, "Limit");
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMGetFscParameter: can't get cfm setting!",
@@ -2152,7 +2152,7 @@
"/xyz/openbmc_project/control/power_supply_redundancy",
"xyz.openbmc_project.Control.PowerSupplyRedundancy", "PSUNumber");
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Failed to get PSUNumber property from dbus interface");
@@ -2693,7 +2693,7 @@
: gpiod::line_request::FLAG_ACTIVE_LOW});
line.set_value(ledStateBits[i + group * groupSize]);
}
- catch (std::system_error&)
+ catch (const std::system_error&)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error write Led Gpio Device!",
@@ -2736,7 +2736,7 @@
"ProductId");
prodId = static_cast<uint8_t>(std::get<uint64_t>(propValue));
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMReadBoardProductId: Product ID read failed!",
@@ -3017,7 +3017,7 @@
return ipmi::responseResponseError();
}
}
- catch (sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception::exception& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return ipmi::responseResponseError();
@@ -3085,7 +3085,7 @@
static_cast<bool>(true));
}
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return ipmi::responseResponseError();
@@ -3179,7 +3179,7 @@
{
bus->call(call);
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMSetDimmOffset: can't set dimm offsets!",
@@ -3365,7 +3365,7 @@
return ipmi::responseSuccess(setParmVersion, parameter, oneTime,
bootOption);
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return ipmi::responseResponseError();
@@ -3462,7 +3462,7 @@
setDbusProperty(*dbus, service, bootObjPath, bootSourceIntf,
bootSourceProp, bootSource);
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return ipmi::responseResponseError();