catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id1b5054d3147c39d98309bc11ed7016d6909e2a6
diff --git a/control/fanctl.cpp b/control/fanctl.cpp
index 07ae84b..0061094 100644
--- a/control/fanctl.cpp
+++ b/control/fanctl.cpp
@@ -302,7 +302,7 @@
val = "false";
}
}
- catch (phosphor::fan::util::DBusPropertyError&)
+ catch (const phosphor::fan::util::DBusPropertyError&)
{
val = "Unknown";
}
@@ -327,7 +327,7 @@
val = "false";
}
}
- catch (phosphor::fan::util::DBusPropertyError&)
+ catch (const phosphor::fan::util::DBusPropertyError&)
{
val = "Unknown";
}
diff --git a/control/json/dbus_zone.cpp b/control/json/dbus_zone.cpp
index af37108..d4b6d23 100644
--- a/control/json/dbus_zone.cpp
+++ b/control/json/dbus_zone.cpp
@@ -85,7 +85,7 @@
iArch(current);
}
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
// Include possible exception when removing file, otherwise ec = 0
std::error_code ec;
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index 4315cf1..691c11f 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -80,7 +80,7 @@
_loadAllowed = true;
load();
}
- catch (std::runtime_error& re)
+ catch (const std::runtime_error& re)
{
// Restore saved available and active profiles
_loadAllowed = false;
diff --git a/control/main.cpp b/control/main.cpp
index 9eec2c5..81c368b 100644
--- a/control/main.cpp
+++ b/control/main.cpp
@@ -98,13 +98,13 @@
}
// Log the useful metadata on these exceptions and let the app
// return 1 so it is restarted without a core dump.
- catch (phosphor::fan::util::DBusServiceError& e)
+ catch (const phosphor::fan::util::DBusServiceError& e)
{
log<level::ERR>("Uncaught DBus service lookup failure exception",
entry("PATH=%s", e.path.c_str()),
entry("INTERFACE=%s", e.interface.c_str()));
}
- catch (phosphor::fan::util::DBusMethodError& e)
+ catch (const phosphor::fan::util::DBusMethodError& e)
{
log<level::ERR>("Uncaught DBus method failure exception",
entry("BUSNAME=%s", e.busName.c_str()),
@@ -112,7 +112,7 @@
entry("INTERFACE=%s", e.interface.c_str()),
entry("METHOD=%s", e.method.c_str()));
}
- catch (phosphor::fan::util::DBusPropertyError& e)
+ catch (const phosphor::fan::util::DBusPropertyError& e)
{
log<level::ERR>("Uncaught DBus property access failure exception",
entry("BUSNAME=%s", e.busName.c_str()),
diff --git a/control/zone.cpp b/control/zone.cpp
index 9efb0c7..49ee35c 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -589,7 +589,7 @@
iArch(current);
}
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
log<level::ERR>(e.what());
fs::remove(path);