[whatwg/streams] Recoverable error from failed parameter validation? (Issue #1280)

There have been some questions from WebTransport and File System where their algorithms have validation steps:

* WebTransport: A pull algorithm throws RangeError if the BYOB view is smaller than the chunk (https://w3c.github.io/webtransport/#datagram-duplex-stream-procedures)
* File System: A write algorithm throws TypeError if there's a missing field in the chunk (https://fs.spec.whatwg.org/#write-a-chunk)

Both of them want to tell the caller that the parameter is invalid, but it cannot be recovered without getting a new stream as the validation error stops the existing stream. There's no good try-catch for those streams.

Maybe File System can do the validation early in its FileSystemWritableFileStream.write() without errorring the stream, but do we want other specs to get their own methods for this? Perhaps also related to #1072.

cc @jesup @jan-ivar @jjjalkanen

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

Message ID: <whatwg/streams/issues/1280@github.com>

Received on Thursday, 25 May 2023 16:15:47 UTC