[whatwg/streams] us.abort() is not called if us.write() fails (#620)

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