- From: Adam Rice <notifications@github.com>
- Date: Thu, 24 Nov 2016 22:05:15 -0800
- To: whatwg/streams <streams@noreply.github.com>
Received on Friday, 25 November 2016 06:05:48 UTC
Currently an exception or rejection from `us.write()` will not result in `us.abort()` being called. If the underlying sink wants to free resources, it has to do it before returning the error. Something like this:
```javascript
class UnderlyingSink {
start() { this.handle = AcquireHandleSomehow(); }
write(chunk) {
return this.handle.write(chunk).catch(e -> {
return this.close().then(() => throw e);
});
}
close() {
return this.handle.freeResources();
}
}
```
If `us.abort()` (with fallback to `us.close()`) was called automatically, then this would become a lot simpler.
--
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/620
Received on Friday, 25 November 2016 06:05:48 UTC