File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
commonMain/kotlin/dev/gitlive/firebase/database
jsMain/kotlin/dev/gitlive/firebase/database Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ object ServerValue {
8686 val TIMESTAMP = Double .POSITIVE_INFINITY
8787}
8888
89- expect class DatabaseException : RuntimeException
89+ expect class DatabaseException ( message : String? , cause : Throwable ? ) : RuntimeException
9090
9191expect class OnDisconnect {
9292 suspend fun removeValue ()
Original file line number Diff line number Diff line change @@ -164,8 +164,9 @@ actual class OnDisconnect internal constructor(val js: firebase.database.OnDisco
164164 rethrow { js.set(encode(strategy, value, encodeDefaults)).awaitWhileOnline() }
165165}
166166
167- actual class DatabaseException (error : dynamic ) :
168- RuntimeException (" ${error.code ? : " UNKNOWN" } : ${error.message} " , error.unsafeCast<Throwable >())
167+ actual class DatabaseException actual constructor(message : String? , cause : Throwable ? ) : RuntimeException(message, cause) {
168+ constructor (error: dynamic ) : this (" ${error.code ? : " UNKNOWN" } : ${error.message} " , error.unsafeCast<Throwable >())
169+ }
169170
170171inline fun <T , R > T.rethrow (function : T .() -> R ): R = dev.gitlive.firebase.database.rethrow { function() }
171172
@@ -189,7 +190,7 @@ suspend fun <T> Promise<T>.awaitWhileOnline(): T = coroutineScope {
189190
190191 select<T > {
191192 this @awaitWhileOnline.asDeferred().onAwait { it.also { notConnected.cancel() } }
192- notConnected.onReceive { throw DatabaseException (" Database not connected" ) }
193+ notConnected.onReceive { throw DatabaseException (" Database not connected" , null ) }
193194 }
194195
195196}
You can’t perform that action at this time.
0 commit comments