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

performWithExceptionHandling function

void performWithExceptionHandling (String name, void work(), void close())

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

Implementation

void performWithExceptionHandling(
    String name, void Function() work, void Function() close) {
  try {
    Timeline.startSync(name);
    work();
  } catch (_e) {
    handleException(name, _e, close);
    rethrow;
  } finally {
    Timeline.finishSync();
  }
}