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 2fa1b2b5905f38431687d83d41efbd3198949fbf..8a43785ab537a1cc8f4e583e01ebea4f29f935d4 100644 |
--- a/sdk/lib/_internal/lib/isolate_patch.dart |
+++ b/sdk/lib/_internal/lib/isolate_patch.dart |
@@ -12,23 +12,33 @@ 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)); |
+ } 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)); |
} |
} |