Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7a88e41 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

chore: add more debug stuff when trying to catch UnauthorizedException. Commit...

chore: add more debug stuff when trying to catch UnauthorizedException. Commit to remove before the merge
parent efb453b4
Loading
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -367,6 +367,10 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
                is InvalidAccountException ->
                    throw e

                is UnauthorizedException -> {
                    Log.d("Vincent", "caught unauthorized exception"+e.message)

                }
                // specific I/O errors
                is SSLHandshakeException -> {
                    Logger.log.log(Level.WARNING, "SSL handshake failed", e)
@@ -857,13 +861,14 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
                syncResult.stats.numIoExceptions++
            }
            is UnauthorizedException -> {
                Log.d("SyncManager.notifyException()", "unauthorizedException has been caught. Try to show a notif")
                Log.d("vincent", "unauthorizedException has been caught. Try to show a notif")
                message = context.getString(R.string.sync_error_authentication_failed)
                syncResult.stats.numAuthExceptions++

                // persistent session cookie is present. Probably the session is outDated. no need to show the notification
                if (accountSettings.containsPersistentCookie()) {
                    Logger.log.log(Level.FINE, "Authorization error. Session outDated")
                    Log.d("vincent", "containts persistent cookie so returnbefore notif")
                    return
                }

@@ -872,9 +877,11 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
                     * https://gitlab.e.foundation/e/backlog/-/issues/3430
                     */
                    Logger.log.log(Level.WARNING, "Authorization error. Do not notify the user")
                    Log.d("Vincent", "containts google elt do not notif")
                    return
                }

                Log.d("Vincent", "user not authorized anymore")
                Logger.log.log(Level.SEVERE, "Not authorized anymore", e)
            }
            is HttpException, is DavException -> {
@@ -937,7 +944,7 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
                .setCategory(NotificationCompat.CATEGORY_ERROR)
        viewItemAction?.let { builder.addAction(it) }

        Log.d("SyncManager.notifyException()", "about to try to notify if possible")
        Log.d("vincent", "about to try to notify if possible")
        notificationManager.notifyIfPossible(notificationTag, NotificationUtils.NOTIFY_SYNC_ERROR, builder.build())
    }