sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Future chaining does not respect ignored futures

Open mraleph opened this issue 1 year ago • 1 comments

import 'dart:async';

void main() async {
  final c = Completer<void>();
  Future.error("a").whenComplete(() {
    c.complete();
    return Future.error("b");
  }).ignore();
  await c.future;
}
$ out/ReleaseX64/dart /tmp/test.dart
Unhandled exception:
b

mraleph avatar Feb 16 '24 12:02 mraleph

Ack. I'd have expected it to be the "a" error which wasn't ignored, if anything. This'll be fun to debug. :sob:

lrhn avatar Feb 16 '24 12:02 lrhn

And for the record, @mraleph was completely correct, it was the chaining which broke the ignore.

lrhn avatar Feb 28 '24 19:02 lrhn