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

Add value field to ErrorKind::UnexpectedValue #9

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

baszalmstra
Copy link
Contributor

@baszalmstra baszalmstra commented Dec 16, 2024

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

Besides showing which values are supported when parsing an enum I would also like to show the user a help message when the user specified value is "very close" to one of the possible values. To do that, I need to be able to access the value in the error handler.

E.g.

× Expected one of 'first-index', 'unsafe-first-match', 'unsafe-best-match'
   ╭─[file.toml:2:27]
 1 │ 
 2 │         index-strategy = "UnsafeFirstMatch"
   ·                           ────────────────
 3 │         
   ╰────
help: Did you mean 'unsafe-first-match'? 

Related Issues

@Jake-Shadle Jake-Shadle changed the title feat: add found value to ErrorKind::UnexpectedValue Add value field to ErrorKind::UnexpectedValue Dec 16, 2024
@Jake-Shadle Jake-Shadle merged commit c4e31ba into EmbarkStudios:main Dec 16, 2024
5 checks passed
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