We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
A user ran into a bug in the form of:
type GraphSyncLinkAction enum { | Present ("p") | Missing ("m") } representation string
then backed in Go by a string, like:
type LinkAction string const ( LinkActionPresent = LinkAction("p") LinkActionMissing = LinkAction("m") )
This didn't work:
AsString: "p" is not a valid member of enum GraphSyncLinkAction
The fix was to use the strings for the enum members at the type level, rather than the representation level, which is how bindnode works:
type LinkAction string const ( LinkActionPresent = LinkAction("Present") LinkActionMissing = LinkAction("Missing") )
This is all working as intended, but the mistake is easy to make, and the error didn't really point the user in the right direction.
We should probably do something here like a better error message, such as:
AsString: "p" is not a valid member of enum GraphSyncLinkAction (bindnode works at the type level; did you mean "Present"?)
The text was updated successfully, but these errors were encountered:
Genuine footgun, also hit in this commit (hence failing tests): dfa7373
Sorry, something went wrong.
fix(bindnode): more helpful error message for enum value footgun
804438f
Fixes: #348
ac672fa
rvagg
Successfully merging a pull request may close this issue.
A user ran into a bug in the form of:
then backed in Go by a string, like:
This didn't work:
The fix was to use the strings for the enum members at the type level, rather than the representation level, which is how bindnode works:
This is all working as intended, but the mistake is easy to make, and the error didn't really point the user in the right direction.
We should probably do something here like a better error message, such as:
The text was updated successfully, but these errors were encountered: