New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception handling in futures is clumsy. #3047
Comments
cc @sigmundch. |
This comment was originally written by sammcca...@google.com Additional shortcomings from more experience: One workaround would be to add a Future.finally(void callback()) that would execute after all .then()s and .handleException()s regardless of the completion outcome. future.handleException((e) => true); Would you accept a patch for this? |
This comment was originally written by sammcca...@google.com Sorry, I forgot the BUG= line in the code review, but this is fixed in https://code.google.com/p/dart/source/detail?r=8303 |
I disagree with the way that any exceptions in the onComplete handler are silently ignored. I think there is a principle that no exceptions are silently swallowed anywhere in Dart. I had a hard time finding and debugging errors in my onComplete handlers because of this. This is now filed as part of bug 4127. |
No plans to change the The You can now either use |
…2 revisions) https://dart.googlesource.com/dartdoc/+log/bd57c0e7b756..f419695f57c5 2022-08-05 srawlins@google.com Fork built-in features into _BuiltInFeature (#3105) 2022-08-04 106621169+klr981@users.noreply.github.com Adopt badge design for all features #3047 (#3101) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/dart-doc-dart-sdk Please CC dart-ecosystem-gardener@grotations.appspotmail.com on the revert to ensure that a human is aware of the problem. To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Tbr: dart-ecosystem-gardener@grotations.appspotmail.com Change-Id: I6b7680fa427fac056756e69700c005ae69bedc79 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253721 Reviewed-by: Devon Carew <devoncarew@google.com> Commit-Queue: Devon Carew <devoncarew@google.com>
This issue was originally filed by sammcca...@google.com
* Requires me to register two handlers
What about
someAsyncMethod().then((result) {
try {
print(result.value);
} catch (SomeException e) {
print("Oh no, error!");
}
});
'result' could be the original Future object, or some Completion<T> object (which would probably play nicer with a unified event/future async model)
The text was updated successfully, but these errors were encountered: