-
Notifications
You must be signed in to change notification settings - Fork 50
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
"invalid key" errors don't print themselves properly #167
Comments
We could consider use of printer.Sprint for this now, which was introduced since this issue was first raised. It might be overkill for this case (?), but might be the right thing to default to if looking at lots of cases of stringing. |
(PL-Launchpad newbie) Oh, this sounds like my kind of thing. |
Go for it! Note that the type now lives under the schema package. Also note that we shouldn't close this issue until we've looked at the other places where we use format verbs like |
assign to me? also, any clues as to how can I trigger the error for test case? |
You can create an ErrInvalidKey with the Key being a node from https://pkg.go.dev/github.com/ipld/go-ipld-prime/node/basicnode#NewString; I seem to recall that's how I got the bad formatting. |
The Error method attempts to use
%q
for an ipld.Node, which will generally not work. It should probably use something likeAsString
instead, unless we have a better way to print nodes for human reading.https://github.com/ipld/go-ipld-prime/blob/v0.9.0/errors.go#L95-L101
We should probably look through ipld-prime and fix all uses of
%s
,%q
,%v
and so on withipld.Node
, because I think none of those are guaranteed to work.The text was updated successfully, but these errors were encountered: