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 errors in the web client crate #729

Open
igamigo opened this issue Feb 12, 2025 · 0 comments
Open

Improve errors in the web client crate #729

igamigo opened this issue Feb 12, 2025 · 0 comments

Comments

@igamigo
Copy link
Collaborator

igamigo commented Feb 12, 2025

We recently moved to a source error style in the client crate and CLI.
In the web client, in order to return errors, a conversion to JsValue is required. In most places (if not all), errors are converted to this type by converting the error type to strings (example). This means we lose source error information because only the top level error variant is converted to string.

To solve this, we may implement a utility function (and a wrapper type) that does the conversion appropriately, where the error chain is correctly conveyed in the converted type. There could be places where we might still want to map errors and not leak internal details, but in general this strategy should be applied throughout the whole crate.
We might want to implement

See this example of a wrapper type and error chain reporting (provided by @PhilippGackstatter).

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

No branches or pull requests

1 participant