From 03ebbc211c8276d8c3b93880ae3a43f462607855 Mon Sep 17 00:00:00 2001 From: Christian Oeing Date: Sun, 18 Oct 2020 21:02:37 +0200 Subject: [PATCH] #47 Throw BoschSHCException instead of raw error to avoid code analysis warning Signed-off-by: Christian Oeing --- .../binding/boschshc/internal/devices/BoschSHCHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/BoschSHCHandler.java b/bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/BoschSHCHandler.java index 071be5c7259f6..e9ed5a9942dc6 100644 --- a/bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/BoschSHCHandler.java +++ b/bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/BoschSHCHandler.java @@ -248,7 +248,8 @@ protected , TState extends BoschSHCServ * from the device. * @param affectedChannels Channels which are affected by the state of this * service. - * @throws BoschSHCException + * @throws BoschSHCException If bridge for handler is not set or an invalid bridge is set. + * @throws BoschSHCException If no device id is set. */ protected , TState extends BoschSHCServiceState> void registerService( TService service, Consumer stateUpdateListener, Collection affectedChannels) @@ -257,7 +258,8 @@ protected , TState extends BoschSHCServ String deviceId = this.getBoschID(); if (deviceId == null) { - throw new Error(String.format("Could not register service for {}, no device id set", this.getThing())); + throw new BoschSHCException( + String.format("Could not register service for %s, no device id set", this.getThing())); } service.initialize(bridgeHandler, deviceId, stateUpdateListener);