OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'dart:isolate'; | |
6 import 'dart:async'; | |
7 | |
8 import 'package:stack_trace/stack_trace.dart'; | |
9 | |
10 import '../../backend/declarer.dart'; | |
kevmoo
2016/02/11 19:57:50
All of these seem to be unused imports...
nweiz
2016/02/11 21:29:18
Done.
| |
11 import '../../backend/group.dart'; | |
12 import '../../backend/live_test.dart'; | |
13 import '../../backend/metadata.dart'; | |
14 import '../../backend/suite.dart'; | |
15 import '../../backend/test.dart'; | |
16 import '../../backend/test_platform.dart'; | |
17 import '../../util/io.dart'; | |
18 import '../../util/remote_exception.dart'; | |
19 import '../../utils.dart'; | |
20 | |
21 /// Capture any top-level errors (mostly lazy syntax errors, since other are | |
22 /// caught below) and report them to the parent isolate. | |
23 void catchIsolateErrors() { | |
24 var errorPort = new ReceivePort(); | |
25 // Aet errors non-fatal because otherwise they'll be double-printed. | |
26 Isolate.current.setErrorsFatal(false); | |
27 Isolate.current.addErrorListener(errorPort.sendPort); | |
28 errorPort.listen((message) { | |
29 // Masquerade as an IsoalteSpawnException because that's what this would | |
30 // be if the error had been detected statically. | |
31 var error = new IsolateSpawnException(message[0]); | |
32 var stackTrace = | |
33 message[1] == null ? new Trace([]) : new Trace.parse(message[1]); | |
34 Zone.current.handleUncaughtError(error, stackTrace); | |
35 }); | |
36 } | |
OLD | NEW |