[whatwg/streams] define semantics of {source,sink}.finally() (#636)

Discussion at https://github.com/whatwg/streams/issues/617#issuecomment-262220474 https://github.com/whatwg/streams/issues/617#issuecomment-262729169 and https://github.com/whatwg/streams/issues/628#issuecomment-266778598 mentioned the need for adding a `finally()` method to underlyingSource and underlyingSink at some point in the future.

It sounds like the ideas for `finally` are
- called after `abort`, `close`, `cancel`, `flush`, etc, are called (after their returned promises fulfill?)
- called with any uncaught errors thrown synchronously by any method, or thrown by strategySize, or thrown by the implementation when e.g. strategy.size() returns NaN
- also called with the rejection reason of any rejected promise that causes the stream to become errored

Proposed arguments were `finally(why, reason)`, where `why` is e.g. the string 'close' or 'abort', but what about all the other causes for `finally` to be called? What would 'why' be for an invalid queueing strategy return value causing a `RangeError`?

Should it stay as two arguments like that, or one object analogous to an IteratorResult?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/636

Received on Wednesday, 21 December 2016 21:54:24 UTC