FallbackConfig

class FallbackConfig<T>(var onFallback: suspend (Throwable) -> T)

Configuration class for the Fallback policy.

This class holds the configuration for what action to take when a fallback is triggered.

Type Parameters

T

The type of the result that the fallback action will return. Must match the return type of the block passed to FallbackPolicy.execute, otherwise a ClassCastException may occur at runtime.

Constructors

Link copied to clipboard
constructor(onFallback: suspend (Throwable) -> T)

Properties

Link copied to clipboard
var onFallback: suspend (Throwable) -> T

A suspend lambda function that is executed when an operation fails (excluding cancellation). It receives the Throwable that caused the failure and must return a value of type T.