Bug 1869225 - Catch `SuggestApiException`s.

This commit adds a `handleSuggestExceptions` helper to
`FxSuggestStorage` that catches and reports `SuggestApiException`s from
the Suggest Rust component. `handleSuggestExceptions` works like the
existing `handle{Fxa, Places}Exceptions` helpers.

`FxSuggestIngestionWorker`'s retry behavior is unchanged: if ingestion
fails, the exception will now be reported, but the operation will still
be rescheduled using `WorkManager`'s retry mechanism, as before.

(cherry picked from commit 2ffae770dca04824498315203182ce7b4e44c102)
fenix/122.0
Lina Butler 5 months ago committed by mergify[bot]
parent 8c90161986
commit b1f28d119c

@ -227,7 +227,7 @@ class Components(private val context: Context) {
)
}
val fxSuggest by lazyMonitored { FxSuggest(context) }
val fxSuggest by lazyMonitored { FxSuggest(context, analytics.crashReporter) }
}
/**

@ -5,6 +5,7 @@
package org.mozilla.fenix.components
import android.content.Context
import mozilla.components.concept.base.crash.CrashReporting
import mozilla.components.feature.fxsuggest.FxSuggestIngestionScheduler
import mozilla.components.feature.fxsuggest.FxSuggestStorage
import org.mozilla.fenix.perf.lazyMonitored
@ -13,10 +14,12 @@ import org.mozilla.fenix.perf.lazyMonitored
* Component group for Firefox Suggest.
*
* @param context The Android application context.
* @param crashReporter An optional [CrashReporting] instance for reporting unexpected caught
* exceptions.
*/
class FxSuggest(context: Context) {
class FxSuggest(context: Context, crashReporter: CrashReporting? = null) {
val storage by lazyMonitored {
FxSuggestStorage(context)
FxSuggestStorage(context, crashReporter)
}
val ingestionScheduler by lazyMonitored {

Loading…
Cancel
Save