-
Notifications
You must be signed in to change notification settings - Fork 431
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
Make CallBuilder
and CreateBuilder
error handling optional
#1602
Conversation
This keeps this more consistent since we're wrapping a few methods with `invoke` in the name anyways.
This reverts commit 72add05. Decided it's best to do this in a standalone PR.
Codecov Report
@@ Coverage Diff @@
## master #1602 +/- ##
==========================================
- Coverage 71.48% 65.66% -5.82%
==========================================
Files 205 205
Lines 6299 6286 -13
==========================================
- Hits 4503 4128 -375
- Misses 1796 2158 +362
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
.fire() | ||
.unwrap_or_else(|err| ::core::panic!("{}: {:?}", #panic_str, err)) | ||
.try_fire() | ||
.unwrap_or_else(|env_err| ::core::panic!("{}: {:?}", #panic_str, env_err)) | ||
.unwrap_or_else(|lang_err| ::core::panic!("{}: {:?}", #panic_str, lang_err)) |
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.
Why not just call fire
?
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.
It looks like the only difference would be that the panic string includes extra info:
let panic_str = format!(
"encountered error while calling <{} as {}>::{}",
forwarder_ident, trait_ident, message_ident,
);
Not sure how useful that is though
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.
Yes I think it is useful. If we just fire
the panic message will just point to the line within the call builder file. Without backtraces (which we don't have) it will be quite hard to find the line which paniced.
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.
LGTM, though we should consider whether/how to unify those errors in a subsequent change.
* Make default behaviour of `fire()` to return "raw" return value * Update delegate call codepath to give option to handle `EnvError` * Update `CreateBuilder::instantiate()`'s default cleaner as well * Add a breaking change note in the changelog * Fix delegator example * Drive-by: rename `fire()` method to `invoke()` This keeps this more consistent since we're wrapping a few methods with `invoke` in the name anyways. * Fix ERC-1155 example * Update `Multisig` example * Fix ContractRef tests * Revert "Drive-by: rename `fire()` method to `invoke()`" This reverts commit 72add05. Decided it's best to do this in a standalone PR. * Use instantiate instead of `try_instantiate` in `delegator` Co-authored-by: Andrew Jones <[email protected]>
This is a follow-up related to this comment.
We're updating the default APIs to unwrap any errors from the Contracts pallet, and
adding some new APIs in case callers do want to handle the errors.
I've also made a drive-by change to rename thefire()
method toinvoke()
. This keepsthings consistent since we're wrapping a few methods with
invoke
in the name anyways.Decided to do this in a follow-up. It's gonna make it easier for people to spot the breaking change.
Plus, extra green squares 🧑🌾
The breaking changes have been noted in the
CHANGELOG
.