From d960199e8f52148bbeabffc81ef9c89f20c603f5 Mon Sep 17 00:00:00 2001 From: Michael Wodniok Date: Sat, 24 Oct 2020 07:07:37 +0200 Subject: [PATCH] [icalendar] Describe download exceptions a bit more detailed. (#8847) * [icalendar] Describe download exceptions a bit more detailed. Fixes #8846 * [icalendar] Apply suggestions from code review Signed-off-by: Michael Wodniok Also-by: Connor Petty --- .../icalendar/internal/handler/PullJob.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java index 87f6f1ba7..b77d39810 100644 --- a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java +++ b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java @@ -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; }