Additional Compensate function that passes the Error object to the callback function.
A sample use case is to check for an item in a cache, call compensate, if the error was not found, then call a persistent storage.
Customer.FetchFromCache(customerId)
.Compensate( e => {
if (e is NotFoundError) return Customer.FetchFromStorage(customerId);
return Result.Failure<Customer>(e);
}
Additional
Compensate
function that passes theError
object to the callback function.A sample use case is to check for an item in a cache, call compensate, if the error was not found, then call a persistent storage.