Skip to content

Commit 36735fb

Browse files
committedSep 24, 2023
throw FirebaseNetworkException on ios FIRAuthErrorCodeNetworkError and js auth/timeout
1 parent a28c34e commit 36735fb

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed
 

‎firebase-auth/src/iosMain/kotlin/dev/gitlive/firebase/auth/auth.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import cocoapods.FirebaseAuth.*
88
import dev.gitlive.firebase.Firebase
99
import dev.gitlive.firebase.FirebaseApp
1010
import dev.gitlive.firebase.FirebaseException
11+
import dev.gitlive.firebase.FirebaseNetworkException
1112
import dev.gitlive.firebase.auth.ActionCodeResult.*
1213
import kotlinx.cinterop.*
1314
import kotlinx.coroutines.CompletableDeferred
1415
import kotlinx.coroutines.channels.awaitClose
1516
import kotlinx.coroutines.flow.callbackFlow
16-
import platform.Foundation.*
17+
import platform.Foundation.NSError
18+
import platform.Foundation.NSURL
1719

1820

1921
actual val Firebase.auth
@@ -208,6 +210,8 @@ private fun NSError.toException() = when(domain) {
208210
FIRAuthErrorCodeWebContextCancelled,
209211
FIRAuthErrorCodeWebInternalError -> FirebaseAuthWebException(toString())
210212

213+
FIRAuthErrorCodeNetworkError -> FirebaseNetworkException(toString())
214+
211215
else -> FirebaseAuthException(toString())
212216
}
213217
else -> FirebaseAuthException(toString())

‎firebase-auth/src/jsMain/kotlin/dev/gitlive/firebase/auth/auth.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ private fun errorToException(cause: dynamic) = when(val code = cause.code?.toStr
165165
"auth/user-token-expired" -> FirebaseAuthInvalidUserException(code, cause)
166166
"auth/web-storage-unsupported" -> FirebaseAuthWebException(code, cause)
167167
"auth/network-request-failed" -> FirebaseNetworkException(code, cause)
168+
"auth/timeout" -> FirebaseNetworkException(code, cause)
168169
"auth/weak-password" -> FirebaseAuthWeakPasswordException(code, cause)
169170
"auth/invalid-credential",
170171
"auth/invalid-verification-code",
@@ -176,7 +177,6 @@ private fun errorToException(cause: dynamic) = when(val code = cause.code?.toStr
176177
"auth/credential-already-in-use" -> FirebaseAuthUserCollisionException(code, cause)
177178
"auth/email-already-in-use" -> FirebaseAuthUserCollisionException(code, cause)
178179
"auth/invalid-email" -> FirebaseAuthEmailException(code, cause)
179-
180180
// "auth/app-deleted" ->
181181
// "auth/app-not-authorized" ->
182182
// "auth/argument-error" ->

‎gradle.properties

+11-11
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ firebase-perf.skipJsTests=false
4949
firebase-storage.skipJsTests=false
5050

5151
# Versions:
52-
firebase-app.version=1.10.0
53-
firebase-auth.version=1.10.0
54-
firebase-common.version=1.10.0
55-
firebase-config.version=1.10.0
56-
firebase-database.version=1.10.0
57-
firebase-firestore.version=1.10.0
58-
firebase-functions.version=1.10.0
59-
firebase-installations.version=1.10.0
60-
firebase-perf.version=1.10.0
61-
firebase-crashlytics.version=1.10.0
62-
firebase-storage.version=1.10.0
52+
firebase-app.version=1.10.1
53+
firebase-auth.version=1.10.1
54+
firebase-common.version=1.10.1
55+
firebase-config.version=1.10.1
56+
firebase-database.version=1.10.1
57+
firebase-firestore.version=1.10.1
58+
firebase-functions.version=1.10.1
59+
firebase-installations.version=1.10.1
60+
firebase-perf.version=1.10.1
61+
firebase-crashlytics.version=1.10.1
62+
firebase-storage.version=1.10.1

0 commit comments

Comments
 (0)
Failed to load comments.