Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented Sep 6, 2022

Make the return type of getEntries a variant that can be either a vector of
entries as before or a negative error code. Update the return type of
getNumEntries to be a ssize_t so it can return negative error codes as well.
This caps the number of directory entries that can be reported at around two
billion, but that should be sufficient.

I have manually tested via an injected error that the error handling works
correctly for the OPFS backend, although I was not able to construct a test case
for this.

To catch mistakes in backend implementations, assert where possible that error
codes are negative.
Make the return type of `getEntries` a variant that can be either a vector of
entries as before or a negative error code. Update the return type of
`getNumEntries` to be a ssize_t so it can return negative error codes as well.
This caps the number of directory entries that can be reported at around two
billion, but that should be sufficient.

I have manually tested via an injected error that the error handling works
correctly for the OPFS backend, although I was not able to construct a test case
for this.
Base automatically changed from wasmfs-assert-negative-errors to main September 6, 2022 19:26
@tlively tlively merged commit 9194ea9 into main Sep 6, 2022
@tlively tlively deleted the wasmfs-getentries-errors branch September 6, 2022 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants