-
Notifications
You must be signed in to change notification settings - Fork 33
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
Error details for failed receives #86
Comments
Thanks for opening the issue! Yes, correct the error handling is very bad right now. That is partialy due to the mints only recent upgrade to expressive errors, and partially due to a switch from axios to fetch in the library that this has not been implemented propperly yet. The mints are upgraded now, and we've switched to fetch, so error handling should be next on the list! Feel free to open a PR regarding this, I will handle the merging.
The thing is, we can have partial success because there can be tokens from different mints inside a token. But as far as i can tell from the discussions from the TG channel, we will switch to a simpler data structure that only contains one token per this would solve our problem Proofs inside a token are transactional, if there is a single invalid proof, the token can't be claimed. |
🔥 |
I'll make a pr hopefully tonight and we can build from there 🙏 |
Following up on this, I have actually now done 2 stages of refactoring. The first is in this PR: #88 And I want to get that reviewed and merged before I make the second change in order to keep the changes small and manageable, but I don't mind talking about the change here.
|
thanks for the work on this @dipunm . I will close the issue for now. It is being discussed in other places now. |
Currently, the library will make some assumptions, and will hide details of what went wrong when a proof fails to be
split
.Specifically, I am looking at the following methods:
I would like to at the very least be able to identify the difference between a server rejecting a request (token has already been claimed) vs network issues (eg. http timeout or unexpected response)
There are a few ways to achieve this, but with the current design, I am not sure what considerations I am missing. Also with #85 in progress, I think its too early to attempt a PR.
That said, hopefully this can kick off a discussion at the very least.
My initial thoughts here, the least breaking change, is to add a new property to
ReceiveTokenEntryResponse
andReceiveResponse
to include the original error(s) that caused the failure(s).That said, I would also suggest a change in design if possible. Returning an object with both
proofs
ortokens
and____WithErrors
implies that you can have partial success. If this is not the case (as I assume is not the case based on the current implementation), then throwing an error seems like a more straightforward and standard solution. If not throwing an error, then an object that more succinctly identifies as an error (eg. aFailed....Response
) or just adding a simple flag likesuccess: true|false
would help to solidify that there is no partial success.If there is partial success, I think this becomes a pretty difficult thing to manage, so I hope that's not the case honestly, but if so, then we should explore how clients should handle this and what type of design we need to support that.
The text was updated successfully, but these errors were encountered: