| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // OtherScripts=error_at_spawnuri_iso.dart | 5 // OtherScripts=error_at_spawnuri_iso.dart |
| 6 | 6 |
| 7 library error_at_spawnuri; | 7 library error_at_spawnuri; |
| 8 | 8 |
| 9 import "dart:isolate"; | 9 import "dart:isolate"; |
| 10 import "dart:async"; | 10 import "dart:async"; |
| 11 import "package:async_helper/async_helper.dart"; | 11 import "package:async_helper/async_helper.dart"; |
| 12 import "package:expect/expect.dart"; | 12 import "package:expect/expect.dart"; |
| 13 | 13 |
| 14 main(){ | 14 main() { |
| 15 asyncStart(); | 15 asyncStart(); |
| 16 | 16 |
| 17 // Capture errors from other isolate as raw messages. | 17 // Capture errors from other isolate as raw messages. |
| 18 RawReceivePort errorPort = new RawReceivePort(); | 18 RawReceivePort errorPort = new RawReceivePort(); |
| 19 errorPort.handler = (message) { | 19 errorPort.handler = (message) { |
| 20 String error = message[0]; | 20 String error = message[0]; |
| 21 String stack = message[1]; | 21 String stack = message[1]; |
| 22 Expect.equals(new ArgumentError("fast error").toString(), "$error"); | 22 Expect.equals(new ArgumentError("fast error").toString(), "$error"); |
| 23 errorPort.close(); | 23 errorPort.close(); |
| 24 asyncEnd(); | 24 asyncEnd(); |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 Isolate.spawnUri(Uri.parse("error_at_spawnuri_iso.dart"), [], | 27 Isolate.spawnUri(Uri.parse("error_at_spawnuri_iso.dart"), [], null, |
| 28 null, | 28 // Setup handler as part of spawn. |
| 29 // Setup handler as part of spawn. | 29 errorsAreFatal: false, |
| 30 errorsAreFatal: false, | 30 onError: errorPort.sendPort); |
| 31 onError: errorPort.sendPort); | |
| 32 } | 31 } |
| OLD | NEW |