summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sdbusplus.hpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/sdbusplus.hpp b/src/sdbusplus.hpp
index f37f7de..0a8e715 100644
--- a/src/sdbusplus.hpp
+++ b/src/sdbusplus.hpp
@@ -102,15 +102,23 @@ class SDBusPlus
const std::string& interface)
{
std::vector<std::string> interfaces{interface};
-
- auto object = callMethodAndRead<GetObject>(
- MAPPER_BUSNAME, MAPPER_PATH, MAPPER_INTERFACE, "GetObject", path,
- interfaces);
-
std::string name;
- if (!object.empty())
+
+ try
{
- name = object.begin()->first;
+ auto object = callMethodAndRead<GetObject>(
+ MAPPER_BUSNAME, MAPPER_PATH, MAPPER_INTERFACE, "GetObject",
+ path, interfaces);
+
+ if (!object.empty())
+ {
+ name = object.begin()->first;
+ }
+ }
+ catch (const SdBusError& e)
+ {
+ // Empty responses are expected sometimes, and the calling
+ // code is set up to handle it.
}
return name;
}
OpenPOWER on IntegriCloud