exception: switch to public sdbus exception
SdBusError was intended to be a private error type inside sdbusplus.
Switch all catch locations to use the general sdbusplus::exception type.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ifa2391f2f582cb2cf16dc85012a05e1f4f6659fd
diff --git a/bmc_state_manager.cpp b/bmc_state_manager.cpp
index 3fbe4bf..fb15f8f 100644
--- a/bmc_state_manager.cpp
+++ b/bmc_state_manager.cpp
@@ -21,7 +21,6 @@
namespace server = sdbusplus::xyz::openbmc_project::State::server;
using namespace phosphor::logging;
-using sdbusplus::exception::SdBusError;
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
constexpr auto obmcStandbyTarget = "multi-user.target";
@@ -52,7 +51,7 @@
auto result = this->bus.call(method);
result.read(unitTargetPath);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in GetUnit call", entry("ERROR=%s", e.what()));
return;
@@ -72,7 +71,7 @@
// Is obmc-standby.target active or inactive?
result.read(currentState);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::INFO>("Error in ActiveState Get",
entry("ERROR=%s", e.what()));
@@ -94,7 +93,7 @@
this->bus.call(method);
this->stateSignal.release();
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::INFO>("Error in Unsubscribe",
entry("ERROR=%s", e.what()));
@@ -119,7 +118,7 @@
{
this->bus.call(method);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Failed to subscribe to systemd signals",
entry("ERR=%s", e.what()));
@@ -141,7 +140,7 @@
{
this->bus.call(method);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::INFO>("Error in HardReboot",
entry("ERROR=%s", e.what()));
@@ -167,7 +166,7 @@
{
this->bus.call(method);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::INFO>("Error in StartUnit - replace-irreversibly",
entry("ERROR=%s", e.what()));
@@ -202,7 +201,7 @@
this->bus.call(method);
this->stateSignal.release();
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::INFO>("Error in Unsubscribe",
entry("ERROR=%s", e.what()));
diff --git a/chassis_state_manager.cpp b/chassis_state_manager.cpp
index a424ebf..71f9134 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -29,7 +29,6 @@
namespace server = sdbusplus::xyz::openbmc_project::State::server;
using namespace phosphor::logging;
-using sdbusplus::exception::SdBusError;
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
using sdbusplus::xyz::openbmc_project::State::Shutdown::Power::Error::Blackout;
constexpr auto CHASSIS_STATE_POWEROFF_TGT = "obmc-chassis-poweroff@0.target";
@@ -64,7 +63,7 @@
SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH, SYSTEMD_INTERFACE, "Subscribe");
this->bus.call(method);
}
- catch (const sdbusplus::exception::SdBusError& ex)
+ catch (const sdbusplus::exception::exception& ex)
{
log<level::ERR>("Failed to subscribe to systemd signals",
entry("ERR=%s", ex.what()));
@@ -117,7 +116,7 @@
}
}
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
// It's acceptable for the pgood state service to not be available
// since it will notify us of the pgood state when it comes up.
@@ -173,7 +172,7 @@
auto result = this->bus.call(method);
result.read(unitTargetPath);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in GetUnit call", entry("ERROR=%s", e.what()));
return false;
@@ -191,7 +190,7 @@
auto result = this->bus.call(method);
result.read(currentState);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in ActiveState Get",
entry("ERROR=%s", e.what()));
@@ -217,7 +216,7 @@
uint32_t newStateID{};
msg.read(newStateID, newStateObjPath, newStateUnit, newStateResult);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in state change - bad encoding",
entry("ERROR=%s", e.what()),
diff --git a/discover_system_state.cpp b/discover_system_state.cpp
index 88fa4ab..d440c00 100644
--- a/discover_system_state.cpp
+++ b/discover_system_state.cpp
@@ -27,7 +27,6 @@
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
using namespace sdbusplus::xyz::openbmc_project::Control::Power::server;
-using sdbusplus::exception::SdBusError;
constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper";
@@ -57,7 +56,7 @@
throw std::runtime_error("Error reading mapper response");
}
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in mapper call", entry("ERROR=%s", e.what()),
entry("PATH=%s", path.c_str()),
@@ -84,7 +83,7 @@
auto reply = bus.call(method);
reply.read(property);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in property Get", entry("ERROR=%s", e.what()),
entry("PROPERTY=%s", propertyName.c_str()));
@@ -221,7 +220,7 @@
hostReqState);
}
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in PowerRestorePolicy Get",
entry("ERROR=%s", e.what()));
diff --git a/host_check.cpp b/host_check.cpp
index 23715a1..81dff7f 100644
--- a/host_check.cpp
+++ b/host_check.cpp
@@ -20,7 +20,6 @@
using namespace std::literals;
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Condition::server;
-using sdbusplus::exception::SdBusError;
// Required strings for sending the msg to check on host
constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
@@ -54,7 +53,7 @@
auto mapperResponseMsg = bus.call(mapper);
mapperResponseMsg.read(mapperResponse);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>(
"Error in mapper GetSubTree call for HostFirmware condition",
@@ -105,7 +104,7 @@
return true;
}
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error reading HostFirmware condition",
entry("ERROR=%s", e.what()),
@@ -138,7 +137,7 @@
return true;
}
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error reading Chassis Power State",
entry("ERROR=%s", e.what()),
diff --git a/host_state_manager.cpp b/host_state_manager.cpp
index 2b435a2..00f41cb 100644
--- a/host_state_manager.cpp
+++ b/host_state_manager.cpp
@@ -44,7 +44,6 @@
sdbusplus::xyz::openbmc_project::State::OperatingSystem::server;
using namespace phosphor::logging;
namespace fs = std::experimental::filesystem;
-using sdbusplus::exception::SdBusError;
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
// host-shutdown notifies host of shutdown and that leads to host-stop being
@@ -96,7 +95,7 @@
{
this->bus.call_noreply(method);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Failed to subscribe to systemd signals",
entry("ERR=%s", e.what()));
@@ -164,7 +163,7 @@
auto result = this->bus.call(method);
result.read(unitTargetPath);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in GetUnit call", entry("ERROR=%s", e.what()));
return false;
@@ -182,7 +181,7 @@
auto result = this->bus.call(method);
result.read(currentState);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in ActiveState Get",
entry("ERROR=%s", e.what()));
@@ -264,7 +263,7 @@
return false;
}
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in AutoReboot Get", entry("ERROR=%s", e.what()));
return false;
diff --git a/hypervisor_state_manager.cpp b/hypervisor_state_manager.cpp
index e1f5106..b3afc0c 100644
--- a/hypervisor_state_manager.cpp
+++ b/hypervisor_state_manager.cpp
@@ -24,7 +24,6 @@
// When you see server:: you know we're referencing our base class
namespace server = sdbusplus::xyz::openbmc_project::State::server;
using namespace phosphor::logging;
-using sdbusplus::exception::SdBusError;
server::Host::Transition Hypervisor::requestedHostTransition(Transition value)
{
diff --git a/settings.cpp b/settings.cpp
index f9f100f..9a7879a 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -11,7 +11,6 @@
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-using sdbusplus::exception::SdBusError;
constexpr auto mapperService = "xyz.openbmc_project.ObjectMapper";
constexpr auto mapperPath = "/xyz/openbmc_project/object_mapper";
@@ -43,7 +42,7 @@
elog<InternalFailure>();
}
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in mapper GetSubTree",
entry("ERROR=%s", e.what()));
@@ -112,7 +111,7 @@
auto response = bus.call(mapperCall);
response.read(result);
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in mapper GetObject",
entry("ERROR=%s", e.what()));
diff --git a/systemd_target_signal.cpp b/systemd_target_signal.cpp
index 7d1d1db..032722b 100644
--- a/systemd_target_signal.cpp
+++ b/systemd_target_signal.cpp
@@ -35,7 +35,7 @@
{
this->bus.call_noreply(method);
}
- catch (const sdbusplus::exception::SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Failed to create systemd target error",
entry("ERROR=%s", error.c_str()),
@@ -115,7 +115,7 @@
{
this->bus.call(method);
}
- catch (const sdbusplus::exception::SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
// If error indicates systemd is not on dbus yet then do nothing.
// The systemdNameChangeSignals callback will detect when it is on
diff --git a/utils.cpp b/utils.cpp
index 8961fe9..97255e6 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -12,7 +12,6 @@
{
using namespace phosphor::logging;
-using sdbusplus::exception::SdBusError;
constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper";
@@ -43,7 +42,7 @@
throw std::runtime_error("Error no matching service");
}
}
- catch (const SdBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
log<level::ERR>("Error in mapper call", entry("ERROR=%s", e.what()),
entry("PATH=%s", path.c_str()),