realm-kotlin
realm-kotlin copied to clipboard
Add specific exception for auth errors being sent to to the Sync Session error handler
Closes #1640
This adds a specific exception class for auth errors being sent to the SyncSession error handler. This is relevant as this indicates the user's credentials are no longer valid and they need to log in again.
Some open questions:
- [ ] Should it be possible to update the refresh token on an already open Realm? (this will require changes in Core)
- [ ] It is a bit annoying to create an "auth" type exception under
SyncExceptionwhen we already haveAuthExceptionunderAppException. But relaxing the interface would be a breaking change and besides, this is the only "App" type exception that would surface here anyway. - [ ] Naming... alternatives considered:
SyncSessionExpiredException,SyncAuthException,SyncSessionAuthExpired. ChoosingAuthExpiredExceptionwas somewhat arbitrary, except it felt short and to the point. Not sure ifSyncorSessionshould somehow be part of the name to separate it more from the genericAuthExceptionthat is anAppException. All our other specific exception types end withException
@nirinchev believes that Core would automatically trigger a reconnect if you log the same user back in again. If this happens, users do not need to close the Realm. We need to test the behaviour.