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

Commit 7bb1944

Browse files
kasperlmhevery
authored andcommitted
fix(zone): Avoid silently ignoring uncaught exceptions by default.
Closes #710
1 parent 775bbce commit 7bb1944

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/core/zone.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@ class LongStackTrace {
2929
* A better zone API which implements onTurnDone.
3030
*/
3131
class NgZone {
32-
final async.Zone _outerZone;
32+
final async.Zone _outerZone = async.Zone.current;
3333
async.Zone _zone;
3434

35-
NgZone()
36-
: _outerZone = async.Zone.current
37-
{
35+
NgZone() {
3836
_zone = _outerZone.fork(specification: new async.ZoneSpecification(
3937
run: _onRun,
4038
runUnary: _onRunUnary,
4139
scheduleMicrotask: _onScheduleMicrotask,
4240
handleUncaughtError: _uncaughtError
4341
));
42+
// Prevent silently ignoring uncaught exceptions by forwarding such
43+
// exceptions to the outer zone by default.
44+
onError = (e, s, ls) => _outerZone.handleUncaughtError(e, s);
4445
}
4546

4647

@@ -99,7 +100,7 @@ class NgZone {
99100
_errorThrownFromOnRun = true;
100101
rethrow;
101102
} finally {
102-
_inFinishTurn = false;
103+
_inFinishTurn = false;
103104
}
104105
}
105106

0 commit comments

Comments
 (0)