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

map.LookupByNode reports unhelpful error when given a badly typed input #455

Open
dustmop opened this issue Aug 11, 2022 · 2 comments
Open
Labels
exp/novice Someone with a little familiarity can pick up good first issue Good issue for new contributors help wanted Seeking public contribution on this issue P3 Low: Not priority right now

Comments

@dustmop
Copy link
Contributor

dustmop commented Aug 11, 2022

See c252ec2#diff-01ef2f316335ee972d15e3ff4c13fc77f11790911033d21c03b5155f10284922R242

The method LookupByNode on map expects its argument to be a string. If a bad value such as a number is passed in, the error message is unclear as to the real problem. For example, when map.LookupByNode(basicnode.NewInt(3)) is called, the error is func called on wrong kind: "AsString" called on a int node (kind: int), but only makes sense on string. This is because the parameter is coerced to a string and that error bubbles up to the caller. It would be better if the error were something like LookupByNode needs a string parameter, got (kind: int), letting the caller know exactly what they are doing wrong.

Many other methods on other types have similar issues.

@rvagg rvagg added P3 Low: Not priority right now help wanted Seeking public contribution on this issue good first issue Good issue for new contributors exp/novice Someone with a little familiarity can pick up labels Aug 12, 2022
@ahmedmustafamo
Copy link

@dustmop "...Many other methods on other types have similar issues."
please provide the description with the other methods to apply the error messages on them

@dustmop
Copy link
Contributor Author

dustmop commented Jul 8, 2023

@AhmedMustafa2201 My apologies, I haven't worked on this codebase in about a year and don't recall what this comment is referring to. I'm sure fixing just the single error message would be a helpful improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up good first issue Good issue for new contributors help wanted Seeking public contribution on this issue P3 Low: Not priority right now
Projects
None yet
Development

No branches or pull requests

3 participants