Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

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

Open
kendalharland opened this issue Sep 23, 2015 · 0 comments

Comments

@kendalharland
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant