Google celebrates pride. See how.

performCtrlWithExceptionHandling function

void performCtrlWithExceptionHandling (String name, dynamic ctrl, String type, void additionalErrorListener(Object error, StackTrace stackTrace), void work())

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

Implementation

void performCtrlWithExceptionHandling(
    String name,
    dynamic ctrl,
    String type,
    void Function(Object error, StackTrace? stackTrace) additionalErrorListener,
    void Function() work) {
  try {
    Timeline.startSync(name);
    work();
  } catch (_e, _st) {
    ctrl.proxyError(FidlError('Exception handling $type $name: $_e'));
    additionalErrorListener(_e, _st);
    rethrow;
  } finally {
    Timeline.finishSync();
  }
}