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

Side by Side Diff: src/site/articles/futures-and-error-handling/index.markdown

Issue 27412003: runAsync name change (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: add links to event loop article; add update date Created 7 years, 2 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 unified diff | Download patch
OLDNEW
1 --- 1 ---
2 layout: default 2 layout: default
3 title: "Futures and Error Handling" 3 title: "Futures and Error Handling"
4 description: "Everything you wanted to know about handling errors and 4 description: "Everything you wanted to know about handling errors and
5 exceptions when working with Futures (but were afraid to ask)." 5 exceptions when working with Futures (but were afraid to ask)."
6 rel: 6 rel:
7 author: shailen-tuli 7 author: shailen-tuli
8 has-permalinks: true 8 has-permalinks: true
9 article: 9 article:
10 written_on: 2013-03-07 10 written_on: 2013-03-07
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 return new Future.sync(() { 379 return new Future.sync(() {
380 var x = someFunc(); // Unexpectedly throws in some rare cases. 380 var x = someFunc(); // Unexpectedly throws in some rare cases.
381 var y = 10 / x; // x should not equal 0. 381 var y = 10 / x; // x should not equal 0.
382 ... 382 ...
383 }); 383 });
384 } 384 }
385 {% endprettify %} 385 {% endprettify %}
386 386
387 `Future.sync()` not only allows you to handle errors you know might occur, but 387 `Future.sync()` not only allows you to handle errors you know might occur, but
388 also prevents errors from *accidentally* leaking out of your function. 388 also prevents errors from *accidentally* leaking out of your function.
389
390
391 ## More information
392
393 Read the following documentation for more details on using Futures:
394
395 * [The Event Loop and Dart](/articles/event-loop/),
396 an article that describes how to schedule tasks using Futures
397 * [Future API reference](http://api.dartlang.org/dart_async/Future.html)
398
OLDNEW
« no previous file with comments | « src/site/articles/event-loop/index.markdown ('k') | src/site/articles/using-future-based-apis/index.markdown » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698