Skip to content

Error

//fluxbase-kotlin/io.github.nimbleflux.fluxbase/FluxbaseResponse/Error

[jvm]
class Error(val error: FluxbaseError) : FluxbaseResponse<Nothing>

Failed result. Not a data class: Kotlin 2.2+ forbids the generated component1(): FluxbaseError from clashing with the inherited component1(): Nothing? — destructuring still works via the interface operators above.

Error [jvm]
constructor(error: FluxbaseError)
Name Summary
data [jvm]
open override val data: Nothing?
The data payload on success, or null on error. In the TS SDK this is the data field.
error [jvm]
open override val error: FluxbaseError
The error on failure. Null on success.
Name Summary
component1 [jvm]
open operator fun component1(): Nothing?
Destructuring support: val (data, error) = result. Matches the TS const { data, error } = await ... pattern. These must be members (not extensions) for Kotlin to recognize them in destructuring declarations.
component2 [jvm]
open operator fun component2(): FluxbaseError?
getOrNull [jvm]
fun <T> FluxbaseResponse<T>.getOrNull(): T?
Returns the data on success, or null on error. Equivalent to result.data in the TS SDK.
getOrThrow [jvm]
fun <T> FluxbaseResponse<T>.getOrThrow(): T
Returns the data on success, or throws the error on failure.