catch exceptions as const

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If6aba71f482f75143e6d669763b8853db22318cf
diff --git a/phosphor-power-sequencer/src/power_interface.cpp b/phosphor-power-sequencer/src/power_interface.cpp
index 13d0af6..50f5911 100644
--- a/phosphor-power-sequencer/src/power_interface.cpp
+++ b/phosphor-power-sequencer/src/power_interface.cpp
@@ -54,7 +54,7 @@
 
             sdbusplus::message::message(msg).append(pgood);
         }
-        catch (sdbusplus::exception_t& e)
+        catch (const sdbusplus::exception_t& e)
         {
             return sd_bus_error_set(error, e.name(), e.description());
         }
@@ -87,7 +87,7 @@
 
             sdbusplus::message::message(msg).append(timeout);
         }
-        catch (sdbusplus::exception_t& e)
+        catch (const sdbusplus::exception_t& e)
         {
             return sd_bus_error_set(error, e.name(), e.description());
         }
@@ -121,7 +121,7 @@
             reply.append(pgood);
             reply.method_return();
         }
-        catch (sdbusplus::exception_t& e)
+        catch (const sdbusplus::exception_t& e)
         {
             return sd_bus_error_set(error, e.name(), e.description());
         }
@@ -157,7 +157,7 @@
                 fmt::format("callbackSetPgoodTimeout: {}", timeout).c_str());
             pwrObj->setPgoodTimeout(timeout);
         }
-        catch (sdbusplus::exception_t& e)
+        catch (const sdbusplus::exception_t& e)
         {
             return sd_bus_error_set(error, e.name(), e.description());
         }
@@ -190,7 +190,7 @@
 
             sdbusplus::message::message(msg).append(state);
         }
-        catch (sdbusplus::exception_t& e)
+        catch (const sdbusplus::exception_t& e)
         {
             return sd_bus_error_set(error, e.name(), e.description());
         }
@@ -231,7 +231,7 @@
 
             m.new_method_return().method_return();
         }
-        catch (sdbusplus::exception_t& e)
+        catch (const sdbusplus::exception_t& e)
         {
             return sd_bus_error_set(error, e.name(), e.description());
         }
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index ed1f9af..96dfaa0 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -114,7 +114,7 @@
         file << bindDevice;
         file.close();
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         auto err = errno;
 
@@ -156,7 +156,7 @@
             present = false;
         }
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         log<level::ERR>(
             fmt::format("presenceGPIO read fail: {}", e.what()).c_str());
@@ -261,7 +261,7 @@
                 vinUVFault = false;
             }
         }
-        catch (ReadFailure& e)
+        catch (const ReadFailure& e)
         {
             readFail++;
             phosphor::logging::commit<ReadFailure>();
@@ -316,7 +316,7 @@
             static_cast<void>(
                 pmbusIntf->read("in1_input", phosphor::pmbus::Type::Hwmon));
         }
-        catch (ReadFailure& e)
+        catch (const ReadFailure& e)
         {
             // Since I do not care what the return value is, I really do not
             // care much if it gets a ReadFailure either. However, this
@@ -426,7 +426,7 @@
             assetProps.emplace(MODEL_PROP, ccin);
             modelName = ccin;
         }
-        catch (ReadFailure& e)
+        catch (const ReadFailure& e)
         {
             // Ignore the read failure, let pmbus code indicate failure,
             // path...
@@ -441,7 +441,7 @@
             pn = pmbusIntf->readString(PART_NUMBER, Type::HwmonDeviceDebug);
             assetProps.emplace(PN_PROP, pn);
         }
-        catch (ReadFailure& e)
+        catch (const ReadFailure& e)
         {
             // Ignore the read failure, let pmbus code indicate failure,
             // path...
@@ -451,7 +451,7 @@
         {
             fn = pmbusIntf->readString(FRU_NUMBER, Type::HwmonDeviceDebug);
         }
-        catch (ReadFailure& e)
+        catch (const ReadFailure& e)
         {
             // Ignore the read failure, let pmbus code indicate failure,
             // path...
@@ -464,7 +464,7 @@
             sn = pmbusIntf->readString(SERIAL_NUMBER, Type::HwmonDeviceDebug);
             assetProps.emplace(SN_PROP, sn);
         }
-        catch (ReadFailure& e)
+        catch (const ReadFailure& e)
         {
             // Ignore the read failure, let pmbus code indicate failure,
             // path...
@@ -476,7 +476,7 @@
                 pmbusIntf->readString(FW_VERSION, Type::HwmonDeviceDebug);
             versionProps.emplace(VERSION_PROP, fwVersion);
         }
-        catch (ReadFailure& e)
+        catch (const ReadFailure& e)
         {
             // Ignore the read failure, let pmbus code indicate failure,
             // path...
@@ -541,7 +541,7 @@
 
             auto reply = bus.call(method);
         }
-        catch (std::exception& e)
+        catch (const std::exception& e)
         {
             log<level::ERR>(
                 std::string(e.what() + std::string(" PATH=") + inventoryPath)
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 603c0ef..ee21a81 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -125,7 +125,7 @@
                     std::get_if<std::string>(&properties[presLineName]);
             }
         }
-        catch (std::exception& e)
+        catch (const std::exception& e)
         {}
     }
 
@@ -221,7 +221,7 @@
 
         supportedConfigs.emplace(*model, sys);
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {}
 }
 
@@ -249,7 +249,7 @@
             populateSysProperties(properties);
         }
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         // Interface or property not found. Let the Interfaces Added callback
         // process the information once the interfaces are added to D-Bus.
@@ -288,7 +288,7 @@
             validateConfig();
         }
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         // Ignore, the property may be of a different type than expected.
     }
@@ -350,7 +350,7 @@
 
         auto reply = bus.call(method);
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         log<level::ERR>(
             fmt::format(
diff --git a/phosphor-power-supply/psu_manager.hpp b/phosphor-power-supply/psu_manager.hpp
index 68dd091..d95caa3 100644
--- a/phosphor-power-supply/psu_manager.hpp
+++ b/phosphor-power-supply/psu_manager.hpp
@@ -92,7 +92,7 @@
                 runValidateConfig = true;
             }
         }
-        catch (std::exception& e)
+        catch (const std::exception& e)
         {
             log<level::INFO>("Failed to get power state. Assuming it is off.");
             powerOn = false;
diff --git a/phosphor-power-supply/util.cpp b/phosphor-power-supply/util.cpp
index 73f86e0..858d1a3 100644
--- a/phosphor-power-supply/util.cpp
+++ b/phosphor-power-supply/util.cpp
@@ -21,7 +21,7 @@
             throw std::runtime_error("Line does not exist: " + namedGpio);
         }
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
             fmt::format("Failed to find line: {}", e.what()).c_str());
@@ -60,7 +60,7 @@
         {
             value = line.get_value();
         }
-        catch (std::exception& e)
+        catch (const std::exception& e)
         {
             log<level::ERR>(
                 fmt::format("Failed to get_value of GPIO line: {}", e.what())
@@ -71,7 +71,7 @@
 
         line.release();
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         log<level::ERR>("Failed to request GPIO line",
                         entry("MSG=%s", e.what()));
diff --git a/phosphor-regulators/src/interfaces/manager_interface.cpp b/phosphor-regulators/src/interfaces/manager_interface.cpp
index 47c233d..9e1cb34 100644
--- a/phosphor-regulators/src/interfaces/manager_interface.cpp
+++ b/phosphor-regulators/src/interfaces/manager_interface.cpp
@@ -53,7 +53,7 @@
 
             reply.method_return();
         }
-        catch (sdbusplus::exception_t& e)
+        catch (const sdbusplus::exception_t& e)
         {
             return sd_bus_error_set(error, e.name(), e.description());
         }
@@ -88,7 +88,7 @@
 
             reply.method_return();
         }
-        catch (sdbusplus::exception_t& e)
+        catch (const sdbusplus::exception_t& e)
         {
             return sd_bus_error_set(error, e.name(), e.description());
         }
diff --git a/pmbus.cpp b/pmbus.cpp
index 3440667..5483ca4 100644
--- a/pmbus.cpp
+++ b/pmbus.cpp
@@ -98,7 +98,7 @@
         file.open(path);
         file >> name;
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         log<level::ERR>((std::string("Unable to read PMBus device name "
                                      "PATH=") +
@@ -147,7 +147,7 @@
             elog<InternalFailure>();
         }
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         auto rc = errno;
 
@@ -189,7 +189,7 @@
         file.open(path);
         file >> std::hex >> data;
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         auto rc = errno;
         log<level::ERR>((std::string("Failed to read sysfs file "
@@ -222,7 +222,7 @@
         file.open(path);
         file >> data;
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         auto rc = errno;
         log<level::ERR>((std::string("Failed to read sysfs file "
diff --git a/power-sequencer/pgood_monitor.cpp b/power-sequencer/pgood_monitor.cpp
index 3c74fdb..d86acef 100644
--- a/power-sequencer/pgood_monitor.cpp
+++ b/power-sequencer/pgood_monitor.cpp
@@ -114,7 +114,7 @@
 
         return timer.get_event().loop();
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         log<level::ERR>(e.what());
         log<level::ERR>("Unexpected failure prevented PGOOD checking");
diff --git a/power-sequencer/runtime_monitor.cpp b/power-sequencer/runtime_monitor.cpp
index f706655..01c3e4c 100644
--- a/power-sequencer/runtime_monitor.cpp
+++ b/power-sequencer/runtime_monitor.cpp
@@ -57,7 +57,7 @@
 
         util::powerOff<Shutdown>(bus);
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         // No need to crash
         log<level::ERR>(e.what());
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
index 6775dfb..72728e4 100644
--- a/power-sequencer/ucd90160.cpp
+++ b/power-sequencer/ucd90160.cpp
@@ -72,7 +72,7 @@
             createPowerFaultLog();
         }
     }
-    catch (device_error::ReadFailure& e)
+    catch (const device_error::ReadFailure& e)
     {
         if (!accessError)
         {
@@ -91,7 +91,7 @@
 
         checkPGOODFaults(true);
     }
-    catch (device_error::ReadFailure& e)
+    catch (const device_error::ReadFailure& e)
     {
         if (!accessError)
         {
@@ -156,7 +156,7 @@
                 nv.add("STATUS_VOUT", vout);
                 nv.add("MFR_STATUS", readMFRStatus());
             }
-            catch (device_error::ReadFailure& e)
+            catch (const device_error::ReadFailure& e)
             {
                 log<level::ERR>("ReadFailure when collecting metadata");
                 commit<device_error::ReadFailure>();
@@ -221,7 +221,7 @@
 
             gpiStatus = gpio->second->read();
         }
-        catch (std::exception& e)
+        catch (const std::exception& e)
         {
             if (!accessError)
             {
@@ -254,7 +254,7 @@
                 nv.add("MFR_STATUS", readMFRStatus());
                 nv.add("INPUT_STATUS", status);
             }
-            catch (device_error::ReadFailure& e)
+            catch (const device_error::ReadFailure& e)
             {
                 log<level::ERR>("ReadFailure when collecting metadata");
                 commit<device_error::ReadFailure>();
@@ -285,7 +285,7 @@
         nv.add("STATUS_WORD", readStatusWord());
         nv.add("MFR_STATUS", readMFRStatus());
     }
-    catch (device_error::ReadFailure& e)
+    catch (const device_error::ReadFailure& e)
     {
         log<level::ERR>("ReadFailure when collecting metadata");
         commit<device_error::ReadFailure>();
@@ -383,7 +383,7 @@
 
             value = g.read();
         }
-        catch (std::exception& e)
+        catch (const std::exception& e)
         {
             if (!gpioAccessError)
             {
@@ -449,7 +449,7 @@
         nv.add("STATUS_WORD", readStatusWord());
         nv.add("MFR_STATUS", readMFRStatus());
     }
-    catch (device_error::ReadFailure& e)
+    catch (const device_error::ReadFailure& e)
     {
         log<level::ERR>("ReadFailure when collecting metadata");
         commit<device_error::ReadFailure>();
@@ -471,7 +471,7 @@
         nv.add("STATUS_WORD", readStatusWord());
         nv.add("MFR_STATUS", readMFRStatus());
     }
-    catch (device_error::ReadFailure& e)
+    catch (const device_error::ReadFailure& e)
     {
         log<level::ERR>("ReadFailure when collecting metadata");
         commit<device_error::ReadFailure>();
@@ -493,7 +493,7 @@
         nv.add("STATUS_WORD", readStatusWord());
         nv.add("MFR_STATUS", readMFRStatus());
     }
-    catch (device_error::ReadFailure& e)
+    catch (const device_error::ReadFailure& e)
     {
         log<level::ERR>("ReadFailure when collecting metadata");
         commit<device_error::ReadFailure>();
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index be89ed3..548895d 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -78,7 +78,7 @@
                          std::string(PowerSupplyInputFault::errName));
         }
     }
-    catch (ReadFailure& e)
+    catch (const ReadFailure& e)
     {
         log<level::INFO>("Unable to read the 2 byte STATUS_WORD value to check "
                          "for power-supply input faults.");
@@ -122,7 +122,7 @@
             auto val = pmbusIntf.read(cmd, type);
             nv.add(cmd, val);
         }
-        catch (std::exception& e)
+        catch (const std::exception& e)
         {
             log<level::INFO>("Unable to capture metadata",
                              entry("CMD=%s", cmd.c_str()));
@@ -158,7 +158,7 @@
             updateHistory();
         }
     }
-    catch (ReadFailure& e)
+    catch (const ReadFailure& e)
     {
         if (readFail < FAULT_COUNT)
         {
@@ -597,7 +597,7 @@
             }
         }
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         log<level::INFO>("Failed to resolve error",
                          entry("CALLOUT=%s", callout.c_str()),
@@ -637,7 +637,7 @@
                                                    inventoryPMBusAccessType)
                             : "");
             }
-            catch (ReadFailure& e)
+            catch (const ReadFailure& e)
             {}
         }
     }
@@ -670,7 +670,7 @@
 
         auto reply = bus.call(method);
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         log<level::ERR>(e.what(), entry("PATH=%s", inventoryPath.c_str()));
     }
@@ -699,7 +699,7 @@
 
         recordManager->clear();
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         // Do nothing.  There would already be a journal entry.
     }
diff --git a/power-supply/record_manager.cpp b/power-supply/record_manager.cpp
index 53e8fe3..a182c8c 100644
--- a/power-supply/record_manager.cpp
+++ b/power-supply/record_manager.cpp
@@ -88,7 +88,7 @@
             records.pop_back();
         }
     }
-    catch (InvalidRecordException& e)
+    catch (const InvalidRecordException& e)
     {
         return false;
     }
diff --git a/utility.cpp b/utility.cpp
index ee65cff..04cb6ae 100644
--- a/utility.cpp
+++ b/utility.cpp
@@ -168,7 +168,7 @@
         getProperty<int32_t>(POWER_IFACE, "state", POWER_OBJ_PATH, service, bus,
                              state);
     }
-    catch (std::exception& e)
+    catch (const std::exception& e)
     {
         log<level::INFO>("Failed to get power state.");
     }