swift-nio/Tests/NIOCoreTests/AsyncSequences
David Nadoba e0cc6dd6ff
Throw `CancellationError` instead of returning `nil` during early cancellation. (#2401)
### Motivation:
Follow up PR for https://github.com/apple/swift-nio/pull/2399

We currently still return `nil` if the current `Task` is canceled before the first call to `NIOThrowingAsyncSequenceProducer.AsyncIterator.next()` but it should throw `CancellationError` too.

In addition, the generic `Failure` type turns out to be a problem. Just throwing a `CancellationError` without checking that `Failure` type is `any Swift.Error` or `CancellationError` introduced a type safety violation as we throw an unrelated type.

### Modifications:

- throw `CancellationError` on eager cancellation
-  deprecates the generic `Failure` type of `NIOThrowingAsyncSequenceProducer`. It now must always be `any Swift.Error`. For backward compatibility we will still return nil if `Failure` is not `any Swift.Error` or `CancellationError`.

### Result:

`CancellationError` is now correctly thrown instead of returning `nil` on eager cancelation. Generic `Failure` type is deprecated.
2023-04-11 08:58:01 -07:00
..
NIOAsyncSequenceProducer+HighLowWatermarkBackPressureStrategyTests.swift Building swift-nio with Swift 5.7 for iOS using Xcode 14.0 at 2.48.0. (#2369) 2023-02-17 10:05:43 -08:00
NIOAsyncSequenceTests.swift Rework the `NIOAsyncSequenceProducer` tests to rely less on timings (#2386) 2023-03-07 17:28:34 +00:00
NIOAsyncWriterTests.swift Building swift-nio with Swift 5.7 for iOS using Xcode 14.0 at 2.48.0. (#2369) 2023-02-17 10:05:43 -08:00
NIOThrowingAsyncSequenceTests.swift Throw `CancellationError` instead of returning `nil` during early cancellation. (#2401) 2023-04-11 08:58:01 -07:00