[WasmFS] Catch and report read and write errors in OPFS#17770
Conversation
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
| return accessHandle.read(data, {at: pos}); | ||
| } catch (e) { | ||
| return -1; | ||
| } |
There was a problem hiding this comment.
Hmm, weren't we saying that errPtr is the simpler thing, than to overload the return values?
And specifically, overloading it here means we are limited to 2GB, I think.
There was a problem hiding this comment.
It turns out using negative return values was already the established pattern in this file, but maybe we should update it everywhere to use error pointers. Notably we can use the return value directly here because this is not an async function.
There was a problem hiding this comment.
Also, there is a TODO in opfs_backend.cpp about using an i64 here, which would eliminate the 2GB limit.
There was a problem hiding this comment.
Also see #17774, which tries to make the existing error handling more uniform and robust.
Reading and writing with invalid offsets was the most convenient error to test and produces an EINVAL error. In principle other kinds of errors are also possible, but for now they produce EINVAL as well.
efe09fa to
5b4e64b
Compare

Reading and writing with invalid offsets was the most convenient error to test
and produces an EINVAL error. In principle other kinds of errors are also
possible, but for now they produce EINVAL as well.