catching

suspend fun <T> catching(block: suspend () -> T): Result<T>

Runs block and captures its outcome in a Result, re-throwing CancellationException so coroutine cancellation is never swallowed — unlike the standard-library runCatching, which would trap it.

The exception-based API stays the primary style; reach for this only where a Result reads better than a try / catch at the call site.

val hits = catching { qdrant.search("docs") { query(vector) } }
.getOrElse { emptyList() }