asyncLoggingDropExceptions

fun <T> CoroutineScope.asyncLoggingDropExceptions(errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> T): Deferred<Result<T>>(source)

Creates a new async coroutine with automatic exception logging and dropping. If an exception occurs, it will be logged using the provided logger and wrapped in a Result, which can be checked when the Deferred is awaited.

Return

A Deferred containing a Result representing the async computation

Parameters

errorMessageBuilder

A function to build the error message from the caught exception. Defaults to "Something web wrong"

logger

The logger instance to use for logging exceptions. Defaults to KSLog

context

Additional CoroutineContext for the new coroutine. Defaults to EmptyCoroutineContext

start

The coroutine start option. Defaults to CoroutineStart.DEFAULT

block

The suspending function to execute that returns a value of type T

Type Parameters

T

The return type of the async computation