File tree Expand file tree Collapse file tree 5 files changed +13
-13
lines changed
firebase-auth/src/jsMain/kotlin/dev/gitlive/firebase/auth
firebase-database/src/jsMain/kotlin/dev/gitlive/firebase/database
firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore
firebase-functions/src/jsMain/kotlin/dev/gitlive/firebase/functions Expand file tree Collapse file tree 5 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -87,12 +87,12 @@ private inline fun <R> rethrow(function: () -> R): R {
8787 return function()
8888 } catch (e: Exception ) {
8989 throw e
90- } catch (e: Throwable ) {
90+ } catch (e: dynamic ) {
9191 throw errorToException(e)
9292 }
9393}
9494
95- private fun errorToException (cause : Throwable ) = when (val code = cause.asDynamic(). code as String? ) {
95+ private fun errorToException (cause : dynamic ) = when (val code = ( cause.code as String? )?.toLowerCase() ) {
9696 " auth/invalid-user-token" -> FirebaseAuthInvalidUserException (code, cause)
9797 " auth/requires-recent-login" -> FirebaseAuthRecentLoginRequiredException (code, cause)
9898 " auth/user-disabled" -> FirebaseAuthInvalidUserException (code, cause)
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ android.useAndroidX=true
66testOptions.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
You can’t perform that action at this time.
0 commit comments