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

fix: add more readable error for missing argument in toml #971

Merged
merged 2 commits into from
Mar 9, 2023

Conversation

TomAFrench
Copy link
Member

Related issue(s)

Resolves the second part of #969

Description

Summary of changes

Previously we'd iterate over the fields in Prover.toml, assume there's a matching entry in the ABI and then decode the data. This throws an unhelpful panic if Prover.toml contains an entry which doesn't exist in the ABI when looking up its type.

I've updated this loop to instead work over the expected ABI fields, check if an entry exists in Prover.toml and if not we raise an error saying that the argument with a certain name hasn't been found. As part of this we now pass the argument name into try_from_toml so that we can throw a meaningful error for struct fields.

Dependency additions / changes

Test additions / changes

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Additional context

@TomAFrench TomAFrench changed the title feat(nargo): add more readable error for when users miss an argument fix(nargo): add more readable error for when users miss an argument Mar 9, 2023
@TomAFrench TomAFrench changed the title fix(nargo): add more readable error for when users miss an argument fix: add more readable error for when users miss an argument Mar 9, 2023
@TomAFrench TomAFrench changed the title fix: add more readable error for when users miss an argument fix: add more readable error for argument in toml Mar 9, 2023
@TomAFrench TomAFrench changed the title fix: add more readable error for argument in toml fix: add more readable error for missing argument in toml Mar 9, 2023
jfecher
jfecher previously approved these changes Mar 9, 2023
Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kevaundray kevaundray added this pull request to the merge queue Mar 9, 2023
Merged via the queue into master with commit e31f41f Mar 9, 2023
@kevaundray kevaundray deleted the missing-input-error branch March 9, 2023 22:07
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.

3 participants