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

Assembler should not hide inner errors on re-exports #1297

Open
hackaugusto opened this issue Mar 26, 2024 · 1 comment
Open

Assembler should not hide inner errors on re-exports #1297

hackaugusto opened this issue Mar 26, 2024 · 1 comment

Comments

@hackaugusto
Copy link
Contributor

For additional context: #1295

The assembler should not hide internal errors, if errors are to be wrapped, the inner error should be kept for additional context.

@bitwalker
Copy link
Contributor

I think this should be largely resolved in #1277. Several of the public APIs now return a Report, which retains all of the context of the original error (depending on how it is constructed, i.e. you can obviously discard an error and construct an ad-hoc Report, but we don't generally do that anywhere that I recall). There are also now wrap_err and wrap_err_with extensions provided by the assembly::diagnostics::WrapErr trait which can be used to wrap error types we don't control with additional context, which I've taken advantage of in a few places (largely around I/O errors).

If there are still places where we hide errors/context, then I'd recommend we move those APIs to Report, rather than try to represent every possible internal error as a distinct variant in our own error types.

NOTE: All of this is based on the forks of thiserror and miette that I am maintaining that add support for no-std builds. Once the main feature I'm waiting on in Rust is stabilized, we can switch to the officially published crates for those two dependencies. The Report type and WrapErr trait are provided by miette, but are re-exported in the assembler from the diagnostics module.

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

2 participants