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

Enable to catch serde error in dynamic link #323

Open
loloicci opened this issue Jul 28, 2023 · 0 comments
Open

Enable to catch serde error in dynamic link #323

loloicci opened this issue Jul 28, 2023 · 0 comments
Labels
dynamic_link relate the dynamic link call feature

Comments

@loloicci
Copy link
Contributor

loloicci commented Jul 28, 2023

If serializations or deserializations fail in the code generated by macro #[dynamiclink] or #[callablepoints], the Err is unwrapped, and WASM panics.
I suggest improving the macros to enable generated functions to return Err(e) (e is made from serde::Error).

Design

It is not clear how to declare that "this function returns Err(e) when (de)serialization fails".

  1. add an attribute like #[serde_err] to the function
  2. all functions returning Result<T, E> returns Err(e)

2's compile is sometimes errors unexpectedly if serde::Error cannot automatically cast into E

@da1suk8 da1suk8 added the dynamic_link relate the dynamic link call feature label Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dynamic_link relate the dynamic link call feature
Projects
None yet
Development

No branches or pull requests

2 participants