-
Notifications
You must be signed in to change notification settings - Fork 38
Returning error codes from init and receive functions #22
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
Conversation
Could you also add the auction contract to the CI here:
to avoid such issues in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is on the right track.
It needs some polish, but even in this form it will provide a much better experience on the chain than the "no information" we had before.
It looks like we currently won't able to annotate enum fields with |
On a second look, derive macro helper attributes are a thing--wonderful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
- Make it explicit that reject must be non-zero. - Fix the Default of Reject instance to be non-zero. - Remove the need for an allocator in generated code (format! uses an allocator)
This is to avoid confusion between the From instance and the error code that is ultimately displayed to the user. The remaining issue is that the variant tags are still positive since we cannot easily modify them in a derive macro. We'd have to have another attribute macro to achieve this automatically.
This brings in i/u128 changes as well.
Note: the changes in the auction smart contract are hard to see because I did a reformatting. But the only "real" changes are that the custom error types derive
Reject
(like in the other example contracts), and that it removes fields from theBidTooLow
error, because we don't support enums with fields yet.