Skip to content
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

[WasmFS] Return errors from getEntries and getNumEntries #17807

Merged
merged 2 commits into from
Sep 6, 2022

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.

2 participants