Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2721)

Unified Diff: sdk/lib/_internal/lib/isolate_patch.dart

Issue 88783002: Isolate.spawn{Uri} only reports errors asynchronously. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix dart2js. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/lib/isolate_patch.dart
diff --git a/sdk/lib/_internal/lib/isolate_patch.dart b/sdk/lib/_internal/lib/isolate_patch.dart
index 69fa23ef41e8f5334a455099dbde546d125e3074..96478908ae3eb0fdd8b42f88bcb5be324794162e 100644
--- a/sdk/lib/_internal/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/lib/isolate_patch.dart
@@ -13,23 +13,31 @@ import 'dart:_isolate_helper' show IsolateNatives,
patch class Isolate {
patch static Future<Isolate> spawn(void entryPoint(message), var message) {
- SendPort controlPort = IsolateNatives.spawnFunction(entryPoint, message);
- return new Future<Isolate>.value(new Isolate._fromControlPort(controlPort));
+ try {
+ SendPort controlPort = IsolateNatives.spawnFunction(entryPoint, message);
+ return new Future<Isolate>.value(new Isolate._fromControlPort(controlPort));
Lasse Reichstein Nielsen 2013/11/27 11:41:28 Long line. Ditto on line 37.
floitsch 2013/11/27 13:57:06 Done.
+ } catch (e, st) {
+ return new Future<Isolate>.error(e, st);
+ }
}
patch static Future<Isolate> spawnUri(
Uri uri, List<String> args, var message) {
- if (args is List<String>) {
- for (int i = 0; i < args.length; i++) {
- if (args[i] is! String) {
- throw new ArgumentError("Args must be a list of Strings $args");
+ try {
+ if (args is List<String>) {
+ for (int i = 0; i < args.length; i++) {
+ if (args[i] is! String) {
+ throw new ArgumentError("Args must be a list of Strings $args");
+ }
}
+ } else if (args != null) {
+ throw new ArgumentError("Args must be a list of Strings $args");
}
- } else if (args != null) {
- throw new ArgumentError("Args must be a list of Strings $args");
+ SendPort controlPort = IsolateNatives.spawnUri(uri, args, message);
+ return new Future<Isolate>.value(new Isolate._fromControlPort(controlPort));
+ } catch (e, st) {
+ return new Future<Isolate>.error(e, st);
}
- SendPort controlPort = IsolateNatives.spawnUri(uri, args, message);
- return new Future<Isolate>.value(new Isolate._fromControlPort(controlPort));
}
}

Powered by Google App Engine
This is Rietveld 408576698