catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic8e6ade739bd5ea6e79cac6b9bb2b182748e10c8
diff --git a/extensions/openpower-pels/tools/peltool.cpp b/extensions/openpower-pels/tools/peltool.cpp
index 5a2abf7..1e8c5b4 100644
--- a/extensions/openpower-pels/tools/peltool.cpp
+++ b/extensions/openpower-pels/tools/peltool.cpp
@@ -85,7 +85,7 @@
{
tmp.yearMSB = std::stoul(token.substr(i, 2), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -94,7 +94,7 @@
{
tmp.yearLSB = std::stoul(token.substr(i, 2), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -103,7 +103,7 @@
{
tmp.month = std::stoul(token.substr(i, 2), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -112,7 +112,7 @@
{
tmp.day = std::stoul(token.substr(i, 2), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -121,7 +121,7 @@
{
tmp.hour = std::stoul(token.substr(i, 2), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -130,7 +130,7 @@
{
tmp.minutes = std::stoul(token.substr(i, 2), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -139,7 +139,7 @@
{
tmp.seconds = std::stoul(token.substr(i, 2), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -148,7 +148,7 @@
{
tmp.hundredths = std::stoul(token.substr(i, 2), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -168,7 +168,7 @@
{
num = std::stoul(fileName.substr(fileName.find("_") + 1), 0, 16);
}
- catch (std::exception& err)
+ catch (const std::exception& err)
{
std::cout << "Conversion failure: " << err.what() << std::endl;
}
@@ -428,7 +428,7 @@
foundPEL = true;
}
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
log<level::ERR>("Hit exception while reading PEL File",
entry("FILENAME=%s", fileName.c_str()),
@@ -575,7 +575,7 @@
func(pel, hexDump);
break;
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
std::cerr << " Internal function threw an exception: "
<< e.what() << "\n";
@@ -755,7 +755,7 @@
std::regex scrubRegex(pattern, std::regex::icase);
return scrubRegex;
}
- catch (std::regex_error& e)
+ catch (const std::regex_error& e)
{
if (e.code() == std::regex_constants::error_collate)
std::cerr << "Invalid collating element request\n";