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

Unified Diff: sdk/lib/isolate/isolate_stream.dart

Issue 12886011: Add unhandledExceptionCallback to streamSpawnFunction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 7 years, 9 months 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 | « sdk/lib/isolate/base.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/isolate/isolate_stream.dart
diff --git a/sdk/lib/isolate/isolate_stream.dart b/sdk/lib/isolate/isolate_stream.dart
index 4cb39f1aa9402750c335c057dc62676517daeac3..0f7ff4d56d0ab1f51bdfb3faa1ad23472ec54577 100644
--- a/sdk/lib/isolate/isolate_stream.dart
+++ b/sdk/lib/isolate/isolate_stream.dart
@@ -196,10 +196,18 @@ class IsolateSink extends StreamSink<dynamic> {
* [spawnFunction] returns an [IsolateSink] feeding into the child isolate's
* default stream.
*
+ * The optional [unhandledExceptionCallback] argument is invoked whenever an
+ * exception inside the isolate is unhandled. It can be seen as a big
+ * `try/catch` around everything that is executed inside the isolate. The
+ * callback should return `true` when it was able to handled the exception.
+ *
* See comments at the top of this library for more details.
*/
-IsolateSink streamSpawnFunction(void topLevelFunction()) {
- SendPort sendPort = spawnFunction(topLevelFunction);
+IsolateSink streamSpawnFunction(
+ void topLevelFunction(),
+ [bool unhandledExceptionCallback(IsolateUnhandledException e)]) {
+ SendPort sendPort = spawnFunction(topLevelFunction,
+ unhandledExceptionCallback);
return new IsolateSink._fromPort(sendPort);
}
« no previous file with comments | « sdk/lib/isolate/base.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698