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 name lookup for trappable_error_type configuration #8833

Conversation

alexcrichton
Copy link
Member

This commit improves the experience around using the trappable_error_type configuration by fixing two issues:

  • When an error can't be resolved it doesn't result in a unwrap(), instead a first-class error is returned to get reported.

  • The name lookup procedure is now consistent with the name lookup that the with key does, notably allowing the version to be optional but still supporting the version.

This fixes an issue that came up recently where a path with a version was specified but the old lookup logic ended up requiring that the version wasn't specified because there was only one package with that version. This behavior resulted in a panic with a very long backtrace-based error message which was confusing to parse. By returning an error the error is much more succinct and by supporting more names the original intuition will work.

This commit improves the experience around using the
`trappable_error_type` configuration by fixing two issues:

* When an error can't be resolved it doesn't result in a
  `unwrap()`, instead a first-class error is returned to get reported.

* The name lookup procedure is now consistent with the name lookup that
  the `with` key does, notably allowing the version to be optional but
  still supporting the version.

This fixes an issue that came up recently where a path with a version
was specified but the old lookup logic ended up requiring that the
version wasn't specified because there was only one package with that
version. This behavior resulted in a panic with a very long
backtrace-based error message which was confusing to parse. By returning
an error the error is much more succinct and by supporting more names
the original intuition will work.
@alexcrichton alexcrichton requested a review from a team as a code owner June 18, 2024 15:29
@alexcrichton alexcrichton requested review from fitzgen and removed request for a team June 18, 2024 15:29
@fitzgen fitzgen added this pull request to the merge queue Jun 18, 2024
Merged via the queue into bytecodealliance:main with commit 5f3597e Jun 18, 2024
36 checks passed
@alexcrichton alexcrichton deleted the improve-trappable-error-type-lookup branch June 18, 2024 16:02
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 this pull request may close these issues.

2 participants