Skip to content

Commit

Permalink
#47 Throw BoschSHCException instead of raw error to avoid code analys…
Browse files Browse the repository at this point in the history
…is warning

Signed-off-by: Christian Oeing <[email protected]>
  • Loading branch information
coeing committed Nov 18, 2020
1 parent eadc464 commit 03ebbc2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ protected <TService extends BoschSHCService<TState>, 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 <TService extends BoschSHCService<TState>, TState extends BoschSHCServiceState> void registerService(
TService service, Consumer<TState> stateUpdateListener, Collection<String> affectedChannels)
Expand All @@ -257,7 +258,8 @@ protected <TService extends BoschSHCService<TState>, 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);
Expand Down

0 comments on commit 03ebbc2

Please sign in to comment.