-
Notifications
You must be signed in to change notification settings - Fork 847
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
RFE: Add error-handling example for C API’s wasm_instance_new() #2472
Comments
UPDATE: Per the Rust code it looks like the variable can only ever expose a single trap … so should it be renamed? |
I’ll comment on the naming in the C API repo, as that seems to be the source of the “naming bug”. I can look at creating a PR to provide error handling in the C API examples, sure. Thank you! |
I don’t see anything in https://github.com/WebAssembly/wasm-c-api/blob/master/include/wasm.h that uses the word “traps” … ? |
https://github.com/WebAssembly/wasm-c-api/blob/master/include/wasm.h#L376-L387 I may be confused... but there can be only one trap at a time.
This might be a good idea. What do you think will be good to rename? |
I’m working on a PR just to rename them “trap”. |
2478: Rename wasm_instance_new()’s “traps” argument to “trap”. r=syrusakbary a=FGasper Issue #2472 # Description This clarifies a bit how to properly use the error-handling mechanism in `wasm_instance_new()`, which only produces 0 or 1 traps, not 2+ as the name “traps” implies. # Review - [ ] Add a short description of the change to the CHANGELOG.md file Co-authored-by: Felipe Gasper <felipe@felipegasper.com>
2478: Rename wasm_instance_new()’s “traps” argument to “trap”. r=syrusakbary a=FGasper Issue #2472 # Description This clarifies a bit how to properly use the error-handling mechanism in `wasm_instance_new()`, which only produces 0 or 1 traps, not 2+ as the name “traps” implies. # Review - [ ] Add a short description of the change to the CHANGELOG.md file Co-authored-by: Felipe Gasper <felipe@felipegasper.com>
@syrusakbary @Hywan One of the challenges I’ve found is determining how best to convert a trap’s contents into a string. Extracting the message is straightforward enough, but it would be great to be able to extract names from the stack trace as well. Do you have any insight into how to do this? |
2478: Rename wasm_instance_new()’s “traps” argument to “trap”. r=syrusakbary a=FGasper Issue #2472 # Description This clarifies a bit how to properly use the error-handling mechanism in `wasm_instance_new()`, which only produces 0 or 1 traps, not 2+ as the name “traps” implies. # Review - [ ] Add a short description of the change to the CHANGELOG.md file Co-authored-by: Felipe Gasper <felipe@felipegasper.com>
2478: Rename wasm_instance_new()’s “traps” argument to “trap”. r=syrusakbary a=FGasper Issue #2472 # Description This clarifies a bit how to properly use the error-handling mechanism in `wasm_instance_new()`, which only produces 0 or 1 traps, not 2+ as the name “traps” implies. # Review - [ ] Add a short description of the change to the CHANGELOG.md file Co-authored-by: Felipe Gasper <felipe@felipegasper.com>
See #2444 which has fixed a bug, and more importantly has added more documentation. |
Everything is documented here, https://wasmerio.github.io/wasmer/crates/doc/wasmer_c_api/wasm_c_api/trap/index.html |
^^ @Hywan Are there any examples of this? I don’t see any. It’s straightforward enough to get the error message itself, but what is to be done with the origin and trace? |
This part is not documented yet. |
Motivation
When wasm_instance_new() fails, how should I consume
traps
if it’s non-NULL? Nothing seems to indicate how I can discover how many traps there are.Proposed solution
Add examples that show how to report all of the available information about the failure when
wasm_instance_new()
fails.The text was updated successfully, but these errors were encountered: