[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 <michi@noorganization.org>
Also-by: Connor Petty <mistercpp2000+gitsignoff@gmail.com>
This commit is contained in:
Michael Wodniok 2020-10-24 07:07:37 +02:00 committed by GitHub
parent 788ca22724
commit d960199e8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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;
}