Skip to content

Conversation

@leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented May 14, 2025

What

Change the trait impls on the Error type in the Rust generated code to compare all types and offer sources for all types.

Why

The use of the _ catch-all matches in the trait impls had led to missing cases being implemented over time and error impl is broken / inconsistent. For example, the Utf error condition didn't expose its source error. And the serde json error type was no compared properly.

This problem hasn't caused any big issues that we're aware, since we don't routinely compare XDR error types inside the environment or any tooling, but it's good practice to fix this.

As part of the fix, removed the catch all to reduce the chance we end up in this place again in the future.

Downstream:

@leighmcculloch leighmcculloch marked this pull request as ready for review May 15, 2025 05:34
@leighmcculloch leighmcculloch requested review from a team and dmkozh May 15, 2025 05:34
@leighmcculloch
Copy link
Member Author

I'm going to move this change to stellar/rs-stellar-xdr#447 after stellar/rs-stellar-xdr#449 is merged.

@leighmcculloch leighmcculloch deleted the update-rust-error-comparison branch May 16, 2025 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants