From e87b7dedb98146e12a5548adb3c93006f705f104 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 24 Dec 2019 10:50:30 -0600 Subject: [PATCH] Remove reporting for some types of exceptions --- .../java/org/tasks/caldav/CaldavSynchronizer.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java b/app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java index 52d9a0b51..16a2ecea7 100644 --- a/app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java +++ b/app/src/main/java/org/tasks/caldav/CaldavSynchronizer.java @@ -17,6 +17,8 @@ import at.bitfire.dav4jvm.Response; import at.bitfire.dav4jvm.Response.HrefRelation; import at.bitfire.dav4jvm.exception.DavException; import at.bitfire.dav4jvm.exception.HttpException; +import at.bitfire.dav4jvm.exception.ServiceUnavailableException; +import at.bitfire.dav4jvm.exception.UnauthorizedException; import at.bitfire.dav4jvm.property.CalendarData; import at.bitfire.dav4jvm.property.DisplayName; import at.bitfire.dav4jvm.property.GetCTag; @@ -118,11 +120,18 @@ public class CaldavSynchronizer { } try { synchronize(account); - } catch (SocketTimeoutException | SSLException | ConnectException | UnknownHostException e) { + } catch (SocketTimeoutException + | SSLException + | ConnectException + | UnknownHostException + | UnauthorizedException + | ServiceUnavailableException e) { setError(account, e.getMessage()); } catch (IOException | DavException e) { setError(account, e.getMessage()); - tracker.reportException(e); + if (!(e instanceof HttpException) || ((HttpException) e).getCode() < 500) { + tracker.reportException(e); + } } }