dart-archive / angular.dart

Legacy source repository. See github.com/dart-lang/angular
https://webdev.dartlang.org/angular/
1.24k stars 248 forks source link

mock/zone.dart Assertion that _asyncErrors.isEmpty makes debugging in checked mode difficult #1739

Open kendalharland opened 8 years ago

kendalharland commented 8 years ago

From: angular.dart/lib/mock/zone.dart : microLeap, line 50

microLeap() {
  while (_asyncQueue.isNotEmpty) {
    // copy the queue as it may change.
    var toRun = new List.from(_asyncQueue);
    _asyncQueue.clear();
    // TODO: Support the case where multiple exceptions are thrown.
    // e.g. with a throwNextException() method.
    assert(_asyncErrors.isEmpty);
    toRun.forEach((fn) => fn());
    if (_asyncErrors.isNotEmpty) {
      var e = _asyncErrors.removeAt(0);
      throw ['Async error', e[0], e[1]];
    }
  }
}

When run in checked mode, assert(_asyncErrors.isEmpty) halts execution and the errors from _asyncErrors are never re-thrown which makes debugging difficult. Is this assertion necessary?