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 {
86
86
val TIMESTAMP = Double .POSITIVE_INFINITY
87
87
}
88
88
89
- expect class DatabaseException : RuntimeException
89
+ expect class DatabaseException ( message : String? , cause : Throwable ? ) : RuntimeException
90
90
91
91
expect class OnDisconnect {
92
92
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
164
164
rethrow { js.set(encode(strategy, value, encodeDefaults)).awaitWhileOnline() }
165
165
}
166
166
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
+ }
169
170
170
171
inline fun <T , R > T.rethrow (function : T .() -> R ): R = dev.gitlive.firebase.database.rethrow { function() }
171
172
@@ -189,7 +190,7 @@ suspend fun <T> Promise<T>.awaitWhileOnline(): T = coroutineScope {
189
190
190
191
select<T > {
191
192
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 ) }
193
194
}
194
195
195
196
}
You can’t perform that action at this time.
0 commit comments