catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9e474f2b3e936b9961eaa08693744c466736e768
diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp
index 8c335e5..e367c17 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -172,7 +172,7 @@
nvalue = std::round(nvalue * roundFactor) / roundFactor;
updateValue(nvalue);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
incrementError();
}
diff --git a/src/ADCSensorMain.cpp b/src/ADCSensorMain.cpp
index c3239c2..eea2766 100644
--- a/src/ADCSensorMain.cpp
+++ b/src/ADCSensorMain.cpp
@@ -367,7 +367,7 @@
{
index = std::stoi(path.substr(path.size() - 1));
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
std::cerr << "Found invalid path " << path << "\n";
return;
diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp
index 73f2ee1..3d602bf 100644
--- a/src/CPUSensorMain.cpp
+++ b/src/CPUSensorMain.cpp
@@ -208,7 +208,7 @@
bus = std::stoi(busStr);
addr = std::stoi(addrStr, nullptr, 16);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
continue;
}
diff --git a/src/ChassisIntrusionSensor.cpp b/src/ChassisIntrusionSensor.cpp
index af5ced3..4b89709 100644
--- a/src/ChassisIntrusionSensor.cpp
+++ b/src/ChassisIntrusionSensor.cpp
@@ -246,7 +246,7 @@
mGpioFd.assign(gpioLineFd);
}
- catch (std::system_error&)
+ catch (const std::system_error&)
{
std::cerr << "ChassisInrtusionSensor error requesting gpio pin name: "
<< mPinName << "\n";
diff --git a/src/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index dbc0d2d..20af79d 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -113,7 +113,7 @@
bus = std::stoi(busStr);
addr = std::stoi(addrStr, nullptr, 16);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
continue;
}
diff --git a/src/PSUSensorMain.cpp b/src/PSUSensorMain.cpp
index e979189..7576e68 100644
--- a/src/PSUSensorMain.cpp
+++ b/src/PSUSensorMain.cpp
@@ -326,7 +326,7 @@
bus = std::stoi(busStr);
addr = std::stoi(addrStr, nullptr, 16);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
std::cerr << "Error parsing bus " << busStr << " addr " << addrStr
<< "\n";
@@ -642,7 +642,7 @@
psuProperty->labelTypeName = std::visit(
VariantToStringVisitor(), findCustomName->second);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
std::cerr << "Unable to parse " << keyName << "\n";
continue;
@@ -661,7 +661,7 @@
psuProperty->sensorScaleFactor = std::visit(
VariantToUnsignedIntVisitor(), findCustomScale->second);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
std::cerr << "Unable to parse " << keyScale << "\n";
continue;
@@ -687,7 +687,7 @@
psuProperty->minReading = std::visit(
VariantToDoubleVisitor(), findCustomMin->second);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
std::cerr << "Unable to parse " << keyMin << "\n";
continue;
@@ -702,7 +702,7 @@
psuProperty->maxReading = std::visit(
VariantToDoubleVisitor(), findCustomMax->second);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
std::cerr << "Unable to parse " << keyMax << "\n";
continue;
@@ -717,7 +717,7 @@
psuProperty->sensorOffset = std::visit(
VariantToDoubleVisitor(), findCustomOffset->second);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
std::cerr << "Unable to parse " << keyOffset << "\n";
continue;
diff --git a/src/PwmSensor.cpp b/src/PwmSensor.cpp
index f76ea50..7b03e68 100644
--- a/src/PwmSensor.cpp
+++ b/src/PwmSensor.cpp
@@ -199,7 +199,7 @@
uint32_t value = std::stoi(line);
return value;
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument&)
{
std::cerr << "Error reading pwm at " << sysPath << "\n";
// throw if not initial read to be caught by dbus bindings
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index d2afba7..30ab202 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -228,7 +228,7 @@
gpioFd.assign(gpioLineFd);
}
- catch (std::system_error&)
+ catch (const std::system_error&)
{
std::cerr << "Error reading gpio: " << gpioName << "\n";
status = false;