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

Improve error message when calling json on void function #278

Closed
agostbiro opened this issue Jun 29, 2023 · 0 comments · Fixed by #286
Closed

Improve error message when calling json on void function #278

agostbiro opened this issue Jun 29, 2023 · 0 comments · Fixed by #286

Comments

@agostbiro
Copy link
Contributor

agostbiro commented Jun 29, 2023

When calling json() on the execution result of function that doesn't return anything, the following error is generated:

Error: DataConversion

Caused by:
    EOF while parsing a value at line 1 column 0

We should catch this and create a better error message for the user that explains the problem.

Minimal code to reproduce assuming a contract with a new method that doesn't return anything:

let worker = workspaces::sandbox().await?;
let wasm = fs::read(/*WASM FILEPATH*/)?;
let contract = worker.dev_deploy(&wasm).await?;
contract.call("new").transact().await?.json()?;
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 a pull request may close this issue.

1 participant