-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recoverable error from failed parameter validation? #1280
Comments
The lack of "soft" errors in WritableStream was an intentional design decision to avoid situations where one of a number of queued writes fails and leaves the output corrupted due to the missing chunk. In File System, writing a chunk with a missing field is clearly an authoring error and I think making it recoverable would just encourage authors to not fix their bugs. The case of an "incorrect buffer size" with WebTransport datagrams is a weird one caused by us ascribing semantics to buffer boundaries in byte streams which was not intended by the streams specification. It can easily be averted by always using buffers of size 65536, so I'm not too worried about our unfriendly behaviour of erroring the whole stream. I think the absence of a hard/soft error distinction makes the standard more predictable and easy-to-use, even if in some cases richer error signalling would be attractive. |
This is an interesting point. Can we do the validation early before queuing? (i.e. have a separate "validation step"?) |
The problem is that the |
Exactly, and that's why I mentioned |
There have been some questions from WebTransport and File System where their algorithms have validation steps:
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
The text was updated successfully, but these errors were encountered: