failLoads

fun failLoads(cause: Throwable, thrown: Boolean = false, times: Int = Int.MAX_VALUE)(source)

Makes the next times loads fail with cause: returned inside Result.failure, or thrown when thrown is true (a store that leaks TimeoutCancellationException throws it).

Parameters

cause

the failure to deliver.

thrown

whether to throw it instead of returning it; false by default.

times

how many loads fail before the store heals; at least 1, every one by default.

Throws

if times is below 1 (a script of no failures is heal).