dvCompensateContext function
Runs context's compensations in reverse order, going on past a failure,
and returns the failures. The generated handler calls it when a backend
function that was handed context throws.
Implementation
Future<List<Object>> dvCompensateContext(DVContext context) async {
final List<Object> failures = <Object>[];
for (final FutureOr<void> Function() compensate
in context.pendingCompensations.reversed) {
try {
await compensate();
} catch (error) {
failures.add(error);
}
}
return failures;
}