Open Bug 2064028 Opened 3 months ago Updated 1 month ago

SyncManager on Android does not handle any errors from Rust SyncManager

Categories

(Firefox for Android :: Accounts and Sync, task)

All
Android
task

Tracking

()

People

(Reporter: segun, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [fxdroid] [android-activation-trust])

Rust's syncmanager has the ability to throw or return certain exceptions logged in SyncManagerError - https://searchfox.org/firefox-main/rev/7c611117298561f542198076e70e641d4dd080bc/third_party/application-services/components/sync_manager/src/error.rs#8-33

We are currently not handling that anywhere in our WorkManagerSyncManager where we invoke the rust API. The work manager work simply gets marked as failure whenever an unhandled exception is thrown.

It would be helpful for understanding behaviour to define some error handling or logging.

Tracking down the error states is a bit tricky because we have more than one way errors are being propagated to us.

  1. ServiceStatus enum that come with a SyncResult
  2. SyncManagerError - which as I understand them, are thrown.

To think about error handling - we would have to do something like this:

return try {
  val syncResult = syncManager.sync(params)
  when(syncResult.status) {
    ServiceStatus.NETWORK_ERROR -> // <-- not thrown
    ServiceStatus.AUTH_ERROR -> // <-- not thrown
  }
} catch(exception: Exception) {
  when(exception) {
    is SyncManagerException.Busy -> // <--- thrown
    is SyncManagerException.PPPPPPPPP -> // <-- other exceptions that are thrown
  }
}

Severity: -- → S3
See Also: → 2067060
Whiteboard: [fxdroid] [android-activation-trust]
See Also: → 1794230
Blocks: 1794230
No longer blocks: 1794230
Depends on: 1794230
You need to log in before you can comment on or make changes to this bug.