catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia8f2ae95679f98f2fc3f32239bbf3b3578c35888
diff --git a/procedures/openfsi/scan.cpp b/procedures/openfsi/scan.cpp
index 48e00a3..c7543d1 100644
--- a/procedures/openfsi/scan.cpp
+++ b/procedures/openfsi/scan.cpp
@@ -52,7 +52,7 @@
file.open(path);
file << "1";
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
auto err = errno;
throw std::system_error(err, std::generic_category());
@@ -78,7 +78,7 @@
{
doScan(masterScanPath);
}
- catch (std::system_error& e)
+ catch (const std::system_error& e)
{
log<level::ERR>("Failed to run the FSI master scan");
@@ -104,7 +104,7 @@
{
doScan(hubScanPath);
}
- catch (std::system_error& e)
+ catch (const std::system_error& e)
{
// If the device driver is ever updated in the future to fail the sysfs
// write call on a scan failure then it should also provide some hints
diff --git a/procedures/p9/cleanup_pcie.cpp b/procedures/p9/cleanup_pcie.cpp
index 316700d..d84b7c9 100644
--- a/procedures/p9/cleanup_pcie.cpp
+++ b/procedures/p9/cleanup_pcie.cpp
@@ -51,7 +51,7 @@
{
writeReg(target, P9_ROOT_CTRL1_CLEAR, 0x00001C00);
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
// Don't need an error log coming from the power off
// path, just keep trying on the other processors.
@@ -59,7 +59,7 @@
}
}
}
- catch (file_error::Open& e)
+ catch (const file_error::Open& e)
{
// For this procedure we can ignore the ::Open error
}
diff --git a/procedures/phal/check_host_running.cpp b/procedures/phal/check_host_running.cpp
index 2ae3fba..d096193 100644
--- a/procedures/phal/check_host_running.cpp
+++ b/procedures/phal/check_host_running.cpp
@@ -42,7 +42,7 @@
{
phal_init();
}
- catch (std::exception& ex)
+ catch (const std::exception& ex)
{
// This should "never" happen so just throw the exception and let
// our systemd error handling process this
@@ -119,7 +119,7 @@
{
phal_init();
}
- catch (std::exception& ex)
+ catch (const std::exception& ex)
{
// This should "never" happen so just throw the exception and let
// our systemd error handling process this
diff --git a/procedures/phal/import_devtree.cpp b/procedures/phal/import_devtree.cpp
index 6d8adc4..d1cff3e 100644
--- a/procedures/phal/import_devtree.cpp
+++ b/procedures/phal/import_devtree.cpp
@@ -82,7 +82,7 @@
fs::remove_all(path);
}
}
- catch (fs::filesystem_error& e)
+ catch (const fs::filesystem_error& e)
{ // Log message and continue. Data already applied successfully.
log<level::ERR>(fmt::format("File({}) delete failed Error:({})",
DEVTREE_EXP_FILE, e.what())
diff --git a/procedures/phal/start_host.cpp b/procedures/phal/start_host.cpp
index 12eddc3..37a14ef 100644
--- a/procedures/phal/start_host.cpp
+++ b/procedures/phal/start_host.cpp
@@ -179,7 +179,7 @@
phal_init();
ipl_set_type(iplType);
}
- catch (std::exception& ex)
+ catch (const std::exception& ex)
{
log<level::ERR>("Exception raised during init PHAL",
entry("EXCEPTION=%s", ex.what()));