performCtrlWithExceptionHandling function

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

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();
  }
}