Improve a little bit Fever login error handling

This commit is contained in:
Shinokuni 2021-12-29 13:12:41 +01:00
parent dcf58a537e
commit 53c5d2f56b
2 changed files with 11 additions and 1 deletions

View File

@ -24,7 +24,13 @@ class FeverDataSource(private val service: FeverService) {
.build() .build()
.adapter(Boolean::class.java) .adapter(Boolean::class.java)
adapter.fromJson(response.source())!! val authenticated = adapter.fromJson(response.source())!!
// Error handling is shit, but it will stay like that until the UI
// and the other data sources/repositories are rewritten in Kotlin
if (!authenticated) {
throw LoginException("Login failed. Please check your credentials")
}
} }
suspend fun sync(syncType: SyncType, syncData: FeverSyncData, body: MultipartBody): FeverSyncResult { suspend fun sync(syncType: SyncType, syncData: FeverSyncData, body: MultipartBody): FeverSyncResult {

View File

@ -0,0 +1,4 @@
package com.readrops.api.utils.exceptions
class LoginException(override val message: String?) : Exception() {
}