summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-10-30 14:23:32 -0700
committerPatrick Venture <venture@google.com>2018-10-30 14:29:57 -0700
commite725286473cf6a522f50b7bfe69fcd56248028bc (patch)
treef35f83d43b42cbf3a4c70e8e663fc2ecde9a17fd
parentc404b3ec2861fe6956f3dd7ce86d404a614c0374 (diff)
downloadphosphor-pid-control-e725286473cf6a522f50b7bfe69fcd56248028bc.tar.gz
phosphor-pid-control-e725286473cf6a522f50b7bfe69fcd56248028bc.zip
sensors: throw build time exceptions on failure
Throw build time exceptions on failure. Change-Id: I7f873e15d0827b2424b9a1cfb6b494546952f1aa Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r--sensors/builder.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/sensors/builder.cpp b/sensors/builder.cpp
index 06d1289..ea4d7cb 100644
--- a/sensors/builder.cpp
+++ b/sensors/builder.cpp
@@ -69,7 +69,12 @@ SensorManager
case IOInterfaceType::DBUSPASSIVE:
ri = DbusPassive::createDbusPassive(PassiveListeningBus,
info->type, name, &helper);
- /* TODO(venture): if this returns nullptr */
+ if (ri == nullptr)
+ {
+ throw SensorBuildException(
+ "Failed to create dbus passive sensor: " + name +
+ " of type: " + info->type);
+ }
break;
case IOInterfaceType::EXTERNAL:
// These are a special case for read-only.
@@ -104,13 +109,18 @@ SensorManager
{
wi = DbusWritePercent::createDbusWrite(
info->writepath, info->min, info->max, helper);
- /* TODO: handle this being nullptr. */
}
else
{
wi = DbusWrite::createDbusWrite(
info->writepath, info->min, info->max, helper);
- /* TODO: handle this being nullptr. */
+ }
+
+ if (wi == nullptr)
+ {
+ throw SensorBuildException(
+ "Unable to create write dbus interface for path: " +
+ info->writepath);
}
break;
OpenPOWER on IntegriCloud