fix: Resolve compile errors with new nested error structure#8561
Conversation
| Err(message) | ||
| }, | ||
| Err(_) => Err(message), | ||
| } |
|
|
||
| impl Outcome { | ||
| pub fn ensure_complete(self) -> Result<(), (u8, Error)> { | ||
| pub fn ensure_complete(self) -> result::Result<(), (u8, Error)> { |
There was a problem hiding this comment.
@franciscoaguirre Please let me know if you'd prefer to replace (u8, Error) with a named struct like ExecutionFailure (as shown below) in this PR, or if you'd rather have it done in a follow-up PR:
pub struct ExecutionFailure {
pub error: Error,
pub index: u8,
}There was a problem hiding this comment.
I think a named struct is clearer. The only problem is we have so many structs named very similar and we'd have to import it everywhere. We could reuse the ExecutorError but the weight field wouldn't be useful for us here.
I would still use a named struct. It provides a much better API and the Outcome of an XCM is a somewhat public API
There was a problem hiding this comment.
Yes, I agree. There are quite a few similarly named structs, which can be a bit confusing, but a named struct does improve readability and long-term maintainability. I’ve merged the supporting change into your feature branch. Since the current PR still uses (u8, Error), I’ll raise a follow-up PR to introduce ExecutionFailure instead. We can always revisit the name later if we think of something more fitting.
There was a problem hiding this comment.
Maybe InstructionError would be a better name. It feels more focused since the struct is really about capturing an error at a specific instruction index.
|
|
||
| impl Outcome { | ||
| pub fn ensure_complete(self) -> Result<(), (u8, Error)> { | ||
| pub fn ensure_complete(self) -> result::Result<(), (u8, Error)> { |
There was a problem hiding this comment.
I think a named struct is clearer. The only problem is we have so many structs named very similar and we'd have to import it everywhere. We could reuse the ExecutorError but the weight field wouldn't be useful for us here.
I would still use a named struct. It provides a much better API and the Outcome of an XCM is a somewhat public API
|
Thanks for doing this! |
c2609f1
into
paritytech:nest-inner-xcm-errors
This PR fixes compile errors introduced in #7730, which adds nested error reporting and instruction index tracking to
pallet-xcm,xcm-executor, and related components.Specifically:
Outcome::ErrorandOutcome::Incomplete.This change helps improve XCM observability and debugging by explicitly identifying the failing instruction in error contexts.