FallbackPolicy
A resilience policy that provides a fallback mechanism.
This policy executes a given code block and, if an exception (a Throwable) is caught, it executes a predefined fallback function. The result of the fallback function is then returned as the result of the execution.
This is useful for providing default values or alternative logic when an operation fails, ensuring that the application can continue to function gracefully.
Parameters
config
The configuration for the fallback policy, specifying the action to take on failure.
onFallbackTriggered
Optional callback invoked when fallback is used (e.g. for telemetry).