Skip to content

Commit

Permalink
[draytonwiser] Clean up exception handling
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Schofield <[email protected]>
  • Loading branch information
andrew-schofield committed Jul 28, 2020
1 parent 435d10a commit f8e278c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,17 @@ public void setSmartPlugAwayAction(final int id, final boolean awayAction) {
failCount++;
if (failCount > 2) {
logger.debug("Heathub didn't repond in time: {}", e.getMessage(), e);
throw new DraytonWiserApiException("Heathub didn't repond in time");
throw new DraytonWiserApiException("Heathub didn't repond in time", e);
}
} catch (final InterruptedException e) {
logger.debug("Interrupted: {}", e.getMessage(), e);
Thread.currentThread().interrupt();
} catch (final ExecutionException e) {
logger.debug("Execution interrupted: {}", e.getMessage(), e);
throw new DraytonWiserApiException(e.getMessage());
throw new DraytonWiserApiException(e.getMessage(), e);
} catch (final RuntimeException e) {
logger.debug("Unexpected error: {}", e.getMessage(), e);
throw new DraytonWiserApiException(e.getMessage());
throw new DraytonWiserApiException(e.getMessage(), e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ public class DraytonWiserApiException extends RuntimeException {
public DraytonWiserApiException(final String message) {
super(message);
}

public DraytonWiserApiException(final String message, final Throwable cause) {
super(message, cause);
}
}

0 comments on commit f8e278c

Please sign in to comment.