]> git.basschouten.com Git - openhab-addons.git/commitdiff
[icalendar] Describe download exceptions a bit more detailed. (#8847)
authorMichael Wodniok <michi@noorganization.org>
Sat, 24 Oct 2020 05:07:37 +0000 (07:07 +0200)
committerGitHub <noreply@github.com>
Sat, 24 Oct 2020 05:07:37 +0000 (22:07 -0700)
* [icalendar] Describe download exceptions a bit more detailed.

Fixes #8846
* [icalendar] Apply suggestions from code review

Signed-off-by: Michael Wodniok <michi@noorganization.org>
Also-by: Connor Petty <mistercpp2000+gitsignoff@gmail.com>
bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java

index 87f6f1ba70b83fa7fb03054ff79b7dc252c7cee7..b77d39810ec3231ab2ab111e301f7afd7fe9c71e 100644 (file)
@@ -48,6 +48,8 @@ import org.slf4j.LoggerFactory;
  * {@link CalendarUpdateListener#onCalendarUpdated()} after successful update.
  *
  * @author Michael Wodniok - Initial contribution
+ * @author Michael Wodniok - Added better descriptions for some errors while
+ *         downloading calendar
  */
 @NonNullByDefault
 class PullJob implements Runnable {
@@ -100,8 +102,17 @@ class PullJob implements Runnable {
         Response response;
         try {
             response = asyncListener.get(HTTP_TIMEOUT_SECS, TimeUnit.SECONDS);
-        } catch (InterruptedException | TimeoutException | ExecutionException e1) {
-            logger.warn("Response for calendar request could not be retrieved. Error message is: {}", e1.getMessage());
+        } catch (InterruptedException e1) {
+            logger.warn("Download of calendar was interrupted.");
+            logger.debug("InterruptedException message is: {}", e1.getMessage());
+            return;
+        } catch (TimeoutException e1) {
+            logger.warn("Download of calendar timed out (waited too long for headers).");
+            logger.debug("TimeoutException message is: {}", e1.getMessage());
+            return;
+        } catch (ExecutionException e1) {
+            logger.warn("Download of calendar failed.");
+            logger.debug("ExecutionException message is: {}", e1.getCause().getMessage());
             return;
         }