+ match $handle_event {
+ Ok(()) => num_handled_events += 1,
+ Err(e) => {
+ // If we encounter an error we stop handling events and make sure to replay
+ // any unhandled events on the next invocation.
+ handling_res = Err(e);
+ break;
+ }
+ }
+ }
+
+ if handling_res.is_ok() {
+ for event in repeated_events {
+ // For repeated events we ignore any errors as they will be replayed eventually
+ // anyways.
+ $event_to_handle = event;
+ let _ = $handle_event;
+ }