Cy-4AH
1
AsyncThrowingStream's initialiser doesn't allow any other error type except Error:
If you try other type you will get compilation error:
Initializer 'init(:bufferingPolicy::)' requires the types 'CancellationError' and 'Error' be equivalent
It's because all initializers have restriction: where Failure == Error
So Failure isn't customisable and should be removed for this reason
2 Likes
Interestingly enough, the Failure generic was not in the original proposal. I believe it was added later with the assumption that Swift will introduce "typed" throws in the future.
2 Likes