+60
−67
Loading
The sole reason for authErrorRegistry was to expose an instance of FxaAccountManager to internal components which don't have direct access to it. The registry acted an internal singleton, but with a bunch of overhead and conceptual complexity around it. This patch simplifies this: it adds an actual singleton instead of the registry, with a simple API for components to call into if they encounter authentication errors. Behaviour of `handleFxaExceptions` also changed slightly, to reduce cognitive overhead: - instead of calling into an Async function on the observer, and ignoring the result, this API is now simply `suspend`, which allows us to reason about error handling within the FxA state machine terms of structured concurrency. Other cleanup involves marking an expensive OAuthAccount method as async, as well as some simplification of error handling in FirefoxAccount.