* @param dtoClass the DTO class to which the JSON result should be deserialized
* @return the deserialized DTO from the JSON response
* @throws IndegoAuthenticationException if request was rejected as unauthorized
+ * @throws IndegoUnreachableException if device cannot be reached (gateway timeout error)
* @throws IndegoException if any communication or parsing error occurred
*/
private <T> T getRequestWithAuthentication(String path, Class<? extends T> dtoClass)
- throws IndegoAuthenticationException, IndegoException {
+ throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
if (!session.isValid()) {
authenticate();
}
* @param dtoClass the DTO class to which the JSON result should be deserialized
* @return the deserialized DTO from the JSON response
* @throws IndegoAuthenticationException if request was rejected as unauthorized
+ * @throws IndegoUnreachableException if device cannot be reached (gateway timeout error)
* @throws IndegoException if any communication or parsing error occurred
*/
private <T> T getRequest(String path, Class<? extends T> dtoClass)
- throws IndegoAuthenticationException, IndegoException {
+ throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
try {
Request request = httpClient.newRequest(BASE_URL + path).method(HttpMethod.GET).header(CONTEXT_HEADER_NAME,
session.getContextId());
*
* @return the device state
* @throws IndegoAuthenticationException if request was rejected as unauthorized
+ * @throws IndegoUnreachableException if device cannot be reached (gateway timeout error)
* @throws IndegoException if any communication or parsing error occurred
*/
- public OperatingDataResponse getOperatingData() throws IndegoAuthenticationException, IndegoException {
+ public OperatingDataResponse getOperatingData()
+ throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
return getRequestWithAuthentication(SERIAL_NUMBER_SUBPATH + this.getSerialNumber() + "/operatingData",
OperatingDataResponse.class);
}
import org.openhab.binding.boschindego.internal.dto.response.OperatingDataResponse;
import org.openhab.binding.boschindego.internal.exceptions.IndegoAuthenticationException;
import org.openhab.binding.boschindego.internal.exceptions.IndegoException;
+import org.openhab.binding.boschindego.internal.exceptions.IndegoUnreachableException;
import org.openhab.core.i18n.TimeZoneProvider;
import org.openhab.core.library.types.DateTimeType;
import org.openhab.core.library.types.DecimalType;
} catch (IndegoAuthenticationException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
"@text/offline.comm-error.authentication-failure");
+ } catch (IndegoUnreachableException e) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
+ "@text/offline.comm-error.unreachable");
} catch (IndegoException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
}
}
- private void handleRefreshCommand(String channelId) throws IndegoAuthenticationException, IndegoException {
+ private void handleRefreshCommand(String channelId)
+ throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
switch (channelId) {
case STATE:
case TEXTUAL_STATE:
} catch (IndegoAuthenticationException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
"@text/offline.comm-error.authentication-failure");
+ } catch (IndegoUnreachableException e) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
+ "@text/offline.comm-error.unreachable");
} catch (IndegoException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
}
}
}
- private void refreshOperatingData() throws IndegoAuthenticationException, IndegoException {
+ private void refreshOperatingData()
+ throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
updateOperatingData(controller.getOperatingData());
updateStatus(ThingStatus.ONLINE);
}