catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia4086e77ad205e9a6a73a6ca570036818e3069fe
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index d4835f1..d06bb17 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -379,7 +379,7 @@
data = 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;
diff --git a/src/selcommands.cpp b/src/selcommands.cpp
index ac68ace..aade561 100644
--- a/src/selcommands.cpp
+++ b/src/selcommands.cpp
@@ -61,12 +61,12 @@
data.push_back(static_cast<uint8_t>(
std::stoul(hexStr.substr(i, 2), nullptr, 16)));
}
- catch (std::invalid_argument& e)
+ catch (const std::invalid_argument& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return -1;
}
- catch (std::out_of_range& e)
+ catch (const std::out_of_range& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return -1;
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index e7ee3ad..6586fff 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -106,7 +106,7 @@
auto reply = dbus.call(managedObj);
reply.read(managedObjects);
}
- catch (sdbusplus::exception_t&)
+ catch (const sdbusplus::exception_t&)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error getting managed objects from connection",
@@ -142,7 +142,7 @@
{
sdbusplus::message::message writeFruResp = dbus.call(writeFru);
}
- catch (sdbusplus::exception_t&)
+ catch (const sdbusplus::exception_t&)
{
// todo: log sel?
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -185,7 +185,7 @@
sdbusplus::message::message resp = dbus.call(getObjects);
resp.read(frus);
}
- catch (sdbusplus::exception_t&)
+ catch (const sdbusplus::exception_t&)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"replaceCacheFru: error getting managed objects");
@@ -269,7 +269,7 @@
sdbusplus::message::message getRawResp = dbus.call(getRawFru);
getRawResp.read(fruCache);
}
- catch (sdbusplus::exception_t&)
+ catch (const sdbusplus::exception_t&)
{
lastDevId = 0xFF;
cacheBus = 0xFF;
@@ -456,7 +456,7 @@
sdbusplus::message::message resp = dbus.call(getObjects);
resp.read(frus);
}
- catch (sdbusplus::exception_t&)
+ catch (const sdbusplus::exception_t&)
{
return IPMI_CC_RESPONSE_ERROR;
}