You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we should leave cvm.error to real errors where a contract don't know how to make further progress. For example here:
@executabledef_bid(id: Identifier, amount: int) ->Optional[Bid]:
row=get_auction(id)
ifisinstance(row, None):
cvm.error(f"You don't have access to this auction.")
ifamount<=last_bid.amount:
cvm.error(f"The bid amount must be larger than current bid amount ${last_bid.amount}.")
This is expected behaviour and we should return a job complete result indicating that the bid was insufficient.
The downside of using cvm.error everywhere is that we end-up creating job fail events which are indistinguishable from job fail events due to a channel which cannot be rotated (because the key alias is not the owner anymore), a temporary failure to post a transaction to Smartlog or a bug on the platform.
Maybe one way forward is to make a stronger distinction in the language between failures and errors where
failures are non-"happy path" conditions but totally expected flows
errors are the equivalent of asserts in other programming languages
The text was updated successfully, but these errors were encountered:
I think we should leave
cvm.error
to real errors where a contract don't know how to make further progress. For example here:However when someone places a bid with an insufficient amount:
This is expected behaviour and we should return a job complete result indicating that the bid was insufficient.
The downside of using
cvm.error
everywhere is that we end-up creating job fail events which are indistinguishable from job fail events due to a channel which cannot be rotated (because the key alias is not the owner anymore), a temporary failure to post a transaction to Smartlog or a bug on the platform.Maybe one way forward is to make a stronger distinction in the language between failures and errors where
The text was updated successfully, but these errors were encountered: