sunshine-protocol / sunshine

Governance + Bounty Platform
Other
43 stars 16 forks source link

change map(|| -> DispatchResult) to for_each() in methods which don't return DispatchResult #168

Closed 4meta5 closed 4 years ago

4meta5 commented 4 years ago

made this mistake a few times in org where I had to call a fallible method in an unfallible method

better approach is to match on the outcome of the fallible method and emit an event to log partial completion

partial execution

tangentially related, but if I have to call a sequence of fallible functions, is there an ergonomic way to enforce atomic execution for the whole sequence (like all of them pass or none of them are executed at all)

4meta5 commented 4 years ago

the partial execution question is still open, I'm thinking that the checks have to be done at the same time so the fallible functions are too high level to do the batch operation...it motivates adding a lower level API for such a transfer (at the same level as Currency).