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

PromiseResult type #158

Closed
gagdiez opened this issue Aug 1, 2022 · 0 comments · Fixed by #208
Closed

PromiseResult type #158

gagdiez opened this issue Aug 1, 2022 · 0 comments · Fixed by #208
Assignees
Labels
DevEx enhancement New feature or request

Comments

@gagdiez
Copy link
Collaborator

gagdiez commented Aug 1, 2022

In #82 the PromiseResult type was changed to string | near.PromiseResult.NotReady | nearPromiseResult.Failed.

From the method's signature it looks like checking for errors would be:

if(near.promiseResult() == near.PromiseResult.Failed){ near.log("the xcc failed") }

However, if a method return the value of 2 it will be falsely assumed there was an error (I tested it in this transaction).

In an scenario such as handling FT, where methods return how many tokens were used, this could lead to potentially devastating errors.

The previous return{status, value} was clear, for which I vote for rolling it back.

@gagdiez gagdiez added enhancement New feature or request DevEx labels Aug 1, 2022
@volovyks volovyks linked a pull request Sep 8, 2022 that will close this issue
@volovyks volovyks self-assigned this Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DevEx enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants