Google is committed to advancing racial equity for Black communities. See how.

performCtrlWithExceptionHandling function

void performCtrlWithExceptionHandling (String name, dynamic ctrl, void work(), String type)

Wraps work with common try/catch behaviour and timeline events.

Implementation

void performCtrlWithExceptionHandling(
    String name, dynamic ctrl, void Function() work, String type) {
  try {
    Timeline.startSync(name);
    work();
  } catch (_e) {
    handleCtrlError(ctrl, 'Exception handling $type $name: $_e');
    rethrow;
  } finally {
    Timeline.finishSync();
  }
}