Skip to content

Commit 7de88af

Browse files
committed
Merge remote-tracking branch 'GitLiveApp/master' into increase_auth_coverage
2 parents b9e5542 + 352c8ba commit 7de88af

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

build.gradle.kts

+4-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ subprojects {
163163
}
164164
}
165165

166-
withType(org.jetbrains.kotlin.gradle.tasks.CInteropProcess::class) {
167-
dependsOn("carthageBootstrap")
166+
if (Os.isFamily(Os.FAMILY_MAC)) {
167+
withType(org.jetbrains.kotlin.gradle.tasks.CInteropProcess::class) {
168+
dependsOn("carthageBootstrap")
169+
}
168170
}
169171

170172
create("carthageClean", Delete::class.java) {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ internal inline fun <R> rethrow(function: () -> R): R {
178178
return function()
179179
} catch (e: Exception) {
180180
throw e
181-
} catch(e: Throwable) {
181+
} catch(e: dynamic) {
182182
throw errorToException(e)
183183
}
184184
}
185185

186-
internal fun errorToException(cause: Throwable) = when(val code = cause.asDynamic().code as String?) {
186+
private fun errorToException(cause: dynamic) = when(val code = (cause.code as String?)?.toLowerCase()) {
187187
"auth/invalid-user-token" -> FirebaseAuthInvalidUserException(code, cause)
188188
"auth/requires-recent-login" -> FirebaseAuthRecentLoginRequiredException(code, cause)
189189
"auth/user-disabled" -> FirebaseAuthInvalidUserException(code, cause)

firebase-database/src/jsMain/kotlin/dev/gitlive/firebase/database/database.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ inline fun <R> rethrow(function: () -> R): R {
150150
return function()
151151
} catch (e: Exception) {
152152
throw e
153-
} catch(e: Throwable) {
153+
} catch(e: dynamic) {
154154
throw DatabaseException(e)
155155
}
156156
}

firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,12 @@ inline fun <R> rethrow(function: () -> R): R {
387387
return function()
388388
} catch (e: Exception) {
389389
throw e
390-
} catch(e: Throwable) {
390+
} catch(e: dynamic) {
391391
throw errorToException(e)
392392
}
393393
}
394394

395-
fun errorToException(e: Throwable) = when(e.asDynamic().code as String?) {
395+
fun errorToException(e: dynamic) = when(e?.code?.toLowerCase()) {
396396
"cancelled" -> FirebaseFirestoreException(e, FirestoreExceptionCode.CANCELLED)
397397
"invalid-argument" -> FirebaseFirestoreException(e, FirestoreExceptionCode.INVALID_ARGUMENT)
398398
"deadline-exceeded" -> FirebaseFirestoreException(e, FirestoreExceptionCode.DEADLINE_EXCEEDED)

firebase-functions/src/jsMain/kotlin/dev/gitlive/firebase/functions/functions.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ inline fun <R> rethrow(function: () -> R): R {
6161
return function()
6262
} catch (e: Exception) {
6363
throw e
64-
} catch(e: Throwable) {
65-
throw FirebaseFunctionsException(e.asDynamic().code as String?, e)
64+
} catch(e: dynamic) {
65+
throw FirebaseFunctionsException(e.code as String?, e)
6666
}
6767
}

gradle.properties

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ android.useAndroidX=true
66
testOptions.unitTests.isIncludeAndroidResources = true
77

88
# Versions:
9-
firebase-app.version=0.3.0
10-
firebase-auth.version=0.3.0
11-
firebase-common.version=0.3.0
12-
firebase-database.version=0.3.0
13-
firebase-firestore.version=0.3.0
14-
firebase-functions.version=0.3.0
9+
firebase-app.version=0.3.1
10+
firebase-auth.version=0.3.1
11+
firebase-common.version=0.3.1
12+
firebase-database.version=0.3.1
13+
firebase-firestore.version=0.3.1
14+
firebase-functions.version=0.3.1

0 commit comments

Comments
 (0)