Package com.rnett.krosstalk.server.result

Functions

Link copied to clipboard
inline fun <R, T : R, E : Throwable> KrosstalkResult<T>.catch(klass: KClass<E>, value: (E) -> KrosstalkResult<R>): KrosstalkResult<R>

Catch an exception by type. Must be called where the exception/KrosstalkResult is created, type information is lost during serialization.

Link copied to clipboard
inline fun <R, T : R, E : Throwable> KrosstalkResult<T>.catchAsHttpError(klass: KClass<E>, statusCode: Int, message: (E) -> String? = { it.message }): KrosstalkResult<R>

Catch an exception by type. Must be called where the exception/KrosstalkResult is created, type information is lost during serialization.

Link copied to clipboard
inline fun <R, T : R, E : Throwable> KrosstalkResult<T>.catchAsSuccess(klass: KClass<E>, value: (E) -> R): KrosstalkResult<R>

Catch an exception by type. Must be called where the exception/KrosstalkResult is created, type information is lost during serialization.