Skip to content

Commit

Permalink
throw exception on creation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazhvera committed Sep 6, 2023
1 parent b92e39b commit 67560c7
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ public IotShadowClient(MqttClientConnection connection) {
* @param connection The connection to use
*/
public IotShadowClient(Mqtt5Client mqtt5Client) throws MqttException{
this.connection = mqtt5Client.NewConnection();
if(this.connection == null)
try
{
throw new MqttException("Failed to setup service client connection.");
this.connection = mqtt5Client.NewConnection();
}
catch(MqttException ex)
{
throw new MqttException("Failed to setup service client connection: " + ex.getMessage());
}
}

Expand Down

0 comments on commit 67560c7

Please sign in to comment.