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

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: Address comments. Created 7 years 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
« no previous file with comments | « runtime/vm/isolate_test.cc ('k') | sdk/lib/_internal/pub/lib/src/dart.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 560fb1f691b34b27389e7b23cfdfaaca322fa345..45de5af4ccf117ea1c12053333ae84a7bf7eeef6 100644
--- a/sdk/lib/_internal/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/lib/isolate_patch.dart
@@ -12,23 +12,31 @@ import 'dart:_isolate_helper' show IsolateNatives,
patch class Isolate {
patch static Future<Isolate> spawn(void entryPoint(message), var message) {
- return IsolateNatives.spawnFunction(entryPoint, message)
- .then((controlPort) => new Isolate._fromControlPort(controlPort));
+ try {
+ return IsolateNatives.spawnFunction(entryPoint, message)
+ .then((controlPort) => 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");
+ return IsolateNatives.spawnUri(uri, args, message)
+ .then((controlPort) => new Isolate._fromControlPort(controlPort));
+ } catch (e, st) {
+ return new Future<Isolate>.error(e, st);
}
- return IsolateNatives.spawnUri(uri, args, message)
- .then((controlPort) => new Isolate._fromControlPort(controlPort));
}
}
« no previous file with comments | « runtime/vm/isolate_test.cc ('k') | sdk/lib/_internal/pub/lib/src/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698