Skip to content

fluxbaseResponse

//fluxbase-kotlin/io.github.nimbleflux.fluxbase/fluxbaseResponse

[jvm]
suspend fun <T> fluxbaseResponse(block: suspend () -> T): FluxbaseResponse<T>

Wraps a suspending block, catching exceptions and converting them to FluxbaseResponse.Error. The TS SDK uses wrapAsync for the same purpose (sdk/src/utils/error-handling.ts).

CancellationException is rethrown, not wrapped: it is the caller cancelling (or a timeout already converted by its own layer — the transport maps Ktor’s request timeout to FluxbaseException, per-request timeouts to FluxbaseError), and swallowing it would leave the coroutine running after its job was cancelled.