-
Notifications
You must be signed in to change notification settings - Fork 822
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
Error type of FunctionMiddleware::feed is private #1950
Comments
We should improve that, so middlewares can report errors! Would you like to work on a PR for it @webmaster128 ? |
I'm happy to help where I can. However, in this case I'm a bit clueless what a desired API would look like. I tried the associated error type from Wasmer 0.17, but this leads to all kind of new generic in the code that uses the middleware. So if I don't a brilliant idea magically, it would be cool if someone from the team could look into it. |
Okay, I got some ideas now that I realized everthing is converted to WasmError at the end of the day. |
1962: Reduce scope of wasmparser::BinaryReaderError in the codebase r=MarkMcCaskey a=webmaster128 ~Based on #1963~ Closes #1950 # Description There is an error conversion pileline `BinaryReaderError` -> `WasmError`. In this PR, the same conversion happens earlier, such that `WasmError`/`WasmResult` can be used in middlewares. Questions: - [ ] Should middlewares be allowed to produce all `WasmError` cases? Or should we introduce a `WasmError::MiddlewareError(String)`? - [x] ~Should `to_wasm_error` be removed as part of this PR?~ Extracted to #1963 # Review - [ ] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Simon Warta <simon@warta.it>
Describe the bug
The error type of the
FunctionMiddleware::feed
isBinaryReaderError
:and
However,
BinaryReaderError
is a type in thewasmparser
crate with no public constructor. So if I understand correctly, a user of Wasmer cannot implement aFunctionMiddleware
that errors.Steps to reproduce
–
Expected behavior
The error type is either constructible or can be defined by the user (as in Wasmer 0.17).
Actual behavior
The error type is fixed to
wasmparser::BinaryReaderError
, which is not constructible.Additional context
I'm trying rewrite a the
Deterministic
middleware, orginally created here: https://github.com/spacemeshos/svm/blob/5df80288c8b9a5ab3665297251c283cb614ebb81/crates/svm-compiler/src/middleware/validation.rs.The text was updated successfully, but these errors were encountered: