@@ -51,7 +51,6 @@ import com.google.android.libraries.identity.googleid.GoogleIdTokenCredential
51
51
import kotlinx.coroutines.flow.first
52
52
import kotlinx.coroutines.flow.map
53
53
import org.json.JSONObject
54
- import retrofit2.HttpException
55
54
import java.io.IOException
56
55
import javax.inject.Inject
57
56
import javax.inject.Singleton
@@ -111,12 +110,10 @@ class AuthRepository @Inject constructor(
111
110
if (response.code() == 401 ) {
112
111
signOut()
113
112
}
114
- AuthResult .Failure (AuthError .UserAlreadyExists )
113
+ AuthResult .Failure (AuthError .ServerError (response.message()) )
115
114
}
116
115
} catch (e: IOException ) {
117
116
AuthResult .Failure (AuthError .NetworkError )
118
- } catch (e: HttpException ) {
119
- AuthResult .Failure (AuthError .ServerError (e.message()))
120
117
} catch (e: Exception ) {
121
118
AuthResult .Failure (AuthError .Unknown (e.message))
122
119
}
@@ -145,12 +142,10 @@ class AuthRepository @Inject constructor(
145
142
if (response.code() == 401 ) {
146
143
signOut()
147
144
}
148
- AuthResult .Failure (AuthError .ServerError (null ))
145
+ AuthResult .Failure (AuthError .ServerError (response.message() ))
149
146
}
150
147
} catch (e: IOException ) {
151
148
AuthResult .Failure (AuthError .NetworkError )
152
- } catch (e: HttpException ) {
153
- AuthResult .Failure (AuthError .ServerError (e.message()))
154
149
} catch (e: Exception ) {
155
150
AuthResult .Failure (AuthError .Unknown (e.message))
156
151
}
@@ -239,8 +234,6 @@ class AuthRepository @Inject constructor(
239
234
}
240
235
} catch (e: IOException ) {
241
236
AuthResult .Failure (AuthError .NetworkError )
242
- } catch (e: HttpException ) {
243
- AuthResult .Failure (AuthError .ServerError (e.message()))
244
237
} catch (e: Exception ) {
245
238
AuthResult .Failure (AuthError .Unknown (e.message))
246
239
}
@@ -313,8 +306,6 @@ class AuthRepository @Inject constructor(
313
306
}
314
307
} catch (e: IOException ) {
315
308
AuthResult .Failure (AuthError .NetworkError )
316
- } catch (e: HttpException ) {
317
- AuthResult .Failure (AuthError .ServerError (e.message()))
318
309
} catch (e: Exception ) {
319
310
AuthResult .Failure (AuthError .Unknown (e.message))
320
311
}
@@ -344,8 +335,6 @@ class AuthRepository @Inject constructor(
344
335
}
345
336
} catch (e: IOException ) {
346
337
AuthResult .Failure (AuthError .NetworkError )
347
- } catch (e: HttpException ) {
348
- AuthResult .Failure (AuthError .ServerError (e.message()))
349
338
} catch (e: Exception ) {
350
339
AuthResult .Failure (AuthError .Unknown (e.message))
351
340
}
@@ -402,7 +391,7 @@ class AuthRepository @Inject constructor(
402
391
if (apiResult.code() == 401 ) {
403
392
signOut()
404
393
}
405
- AuthResult .Failure (AuthError .InvalidCredentials )
394
+ AuthResult .Failure (AuthError .ServerError (apiResult.message()) )
406
395
}
407
396
}
408
397
}
@@ -418,8 +407,6 @@ class AuthRepository @Inject constructor(
418
407
AuthResult .Failure (AuthError .Unknown (null ))
419
408
} catch (e: IOException ) {
420
409
AuthResult .Failure (AuthError .NetworkError )
421
- } catch (e: HttpException ) {
422
- AuthResult .Failure (AuthError .ServerError (e.message()))
423
410
} catch (e: Exception ) {
424
411
AuthResult .Failure (AuthError .Unknown (e.message))
425
412
}
@@ -454,8 +441,6 @@ class AuthRepository @Inject constructor(
454
441
}
455
442
} catch (e: IOException ) {
456
443
AuthResult .Failure (AuthError .NetworkError )
457
- } catch (e: HttpException ) {
458
- AuthResult .Failure (AuthError .ServerError (e.message()))
459
444
} catch (e: Exception ) {
460
445
AuthResult .Failure (AuthError .Unknown (e.message))
461
446
}
@@ -477,7 +462,7 @@ class AuthRepository @Inject constructor(
477
462
/* *
478
463
* Checks if the user is signed in through passkeys.
479
464
*
480
- * @return True if the user is signed in through passkeys, false otherwise.
465
+ * @return True if the user is signed in through passkeys, false otherwise.
481
466
*/
482
467
suspend fun isSignedInThroughPasskeys (): Boolean {
483
468
val isSignedInThroughPasskeys = dataStore.read(IS_SIGNED_IN_THROUGH_PASSKEYS )
@@ -509,8 +494,6 @@ class AuthRepository @Inject constructor(
509
494
}
510
495
} catch (e: IOException ) {
511
496
AuthResult .Failure (AuthError .NetworkError )
512
- } catch (e: HttpException ) {
513
- AuthResult .Failure (AuthError .ServerError (e.message()))
514
497
} catch (e: Exception ) {
515
498
AuthResult .Failure (AuthError .Unknown (e.message))
516
499
}
@@ -598,8 +581,6 @@ class AuthRepository @Inject constructor(
598
581
}
599
582
} catch (e: IOException ) {
600
583
AuthResult .Failure (AuthError .NetworkError )
601
- } catch (e: HttpException ) {
602
- AuthResult .Failure (AuthError .ServerError (e.message()))
603
584
} catch (e: Exception ) {
604
585
AuthResult .Failure (AuthError .Unknown (e.message))
605
586
}
0 commit comments