void _handleUncaughtError()

in lib/src/stack_zone_specification.dart [144:170]


  void _handleUncaughtError(Zone self, ZoneDelegate parent, Zone zone,
      Object error, StackTrace stackTrace) {
    if (_disabled) {
      parent.handleUncaughtError(zone, error, stackTrace);
      return;
    }

    var stackChain = chainFor(stackTrace);
    if (_onError == null) {
      parent.handleUncaughtError(zone, error, stackChain);
      return;
    }

    // TODO(nweiz): Currently this copies a lot of logic from [runZoned]. Just
    // allow [runBinary] to throw instead once issue 18134 is fixed.
    try {
      // TODO(rnystrom): Is the null-assertion correct here? It is nullable in
      // Zone. Should we check for that here?
      self.parent!.runBinary(_onError!, error, stackChain);
    } on Object catch (newError, newStackTrace) {
      if (identical(newError, error)) {
        parent.handleUncaughtError(zone, error, stackChain);
      } else {
        parent.handleUncaughtError(zone, newError, newStackTrace);
      }
    }
  }