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

Issue 269283007: Make errors from StreamController onCancel calls end up in the returned future. (Closed)

Created:
6 years, 7 months ago by Lasse Reichstein Nielsen
Modified:
6 years, 7 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Make errors from StreamController onCancel calls end up in the returned future. This changes errors happening in an onCancel callback from being uncaught async errors (captured by zone.runGuarded) to being put into the result future every time. It already happens if the onCancel returns a future containing an error, but if onCancel throws itself, it was different. This makes onCancel act the same whether it fails immediately or asynchronously. It should not change the behavior of current working programs: an uncaught error would likely terminate the program, and the returned futures are not checked for errors. After the change, the error will reach the future and become uncaught there instead, still terminating the program in the same way. R=ajohnsen@google.com, floitsch@google.com Committed: https://code.google.com/p/dart/source/detail?r=36021

Patch Set 1 #

Total comments: 4

Patch Set 2 : Add tests. Propagate errors during cancel only to cancel future. #

Total comments: 5

Patch Set 3 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+151 lines, -12 lines) Patch
M sdk/lib/async/stream.dart View 1 chunk +5 lines, -0 lines 0 comments Download
M sdk/lib/async/stream_controller.dart View 1 2 4 chunks +49 lines, -12 lines 0 comments Download
M tests/lib/async/stream_controller_test.dart View 1 2 2 chunks +97 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
Lasse Reichstein Nielsen
Please check. Will add tests.
6 years, 7 months ago (2014-05-07 14:31:01 UTC) #1
Lasse Reichstein Nielsen
https://codereview.chromium.org/269283007/diff/1/sdk/lib/async/stream_controller.dart File sdk/lib/async/stream_controller.dart (right): https://codereview.chromium.org/269283007/diff/1/sdk/lib/async/stream_controller.dart#newcode501 sdk/lib/async/stream_controller.dart:501: try { This entire try-catch could just be `cancelFuture ...
6 years, 7 months ago (2014-05-07 14:33:32 UTC) #2
floitsch
Mostly LGTM. missing test. https://codereview.chromium.org/269283007/diff/1/sdk/lib/async/stream_controller.dart File sdk/lib/async/stream_controller.dart (right): https://codereview.chromium.org/269283007/diff/1/sdk/lib/async/stream_controller.dart#newcode512 sdk/lib/async/stream_controller.dart:512: result = result.whenComplete(() => cancelFuture); ...
6 years, 7 months ago (2014-05-07 15:16:25 UTC) #3
Lasse Reichstein Nielsen
https://codereview.chromium.org/269283007/diff/1/sdk/lib/async/stream_controller.dart File sdk/lib/async/stream_controller.dart (right): https://codereview.chromium.org/269283007/diff/1/sdk/lib/async/stream_controller.dart#newcode512 sdk/lib/async/stream_controller.dart:512: result = result.whenComplete(() => cancelFuture); Any reason for wanting ...
6 years, 7 months ago (2014-05-07 17:40:26 UTC) #4
floitsch
https://codereview.chromium.org/269283007/diff/1/sdk/lib/async/stream_controller.dart File sdk/lib/async/stream_controller.dart (right): https://codereview.chromium.org/269283007/diff/1/sdk/lib/async/stream_controller.dart#newcode512 sdk/lib/async/stream_controller.dart:512: result = result.whenComplete(() => cancelFuture); On 2014/05/07 17:40:26, Lasse ...
6 years, 7 months ago (2014-05-07 17:50:50 UTC) #5
Lasse Reichstein Nielsen
We'll wait and do the _onCancel after waiting for the addStream cancel to complete.
6 years, 7 months ago (2014-05-08 13:52:41 UTC) #6
Lasse Reichstein Nielsen
Updated error propagation, PTAL. Errors during a cancel, including both the cancel call on an ...
6 years, 7 months ago (2014-05-09 14:16:39 UTC) #7
floitsch
LGTM. https://codereview.chromium.org/269283007/diff/20001/sdk/lib/async/stream_controller.dart File sdk/lib/async/stream_controller.dart (right): https://codereview.chromium.org/269283007/diff/20001/sdk/lib/async/stream_controller.dart#newcode499 sdk/lib/async/stream_controller.dart:499: if (_onCancel != null) { Give general overview ...
6 years, 7 months ago (2014-05-09 15:39:21 UTC) #8
Anders Johnsen
LGTM, I'm glad we're getting this cleaned up.
6 years, 7 months ago (2014-05-12 06:25:58 UTC) #9
Lasse Reichstein Nielsen
6 years, 7 months ago (2014-05-12 09:48:41 UTC) #10
Message was sent while issue was closed.
Committed patchset #3 manually as r36021 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698