Skip to content

Return errors properly instead of just panicking#602

Open
Shaptic wants to merge 1 commit intomainfrom
dont-panic-on-fetch
Open

Return errors properly instead of just panicking#602
Shaptic wants to merge 1 commit intomainfrom
dont-panic-on-fetch

Conversation

@Shaptic
Copy link
Contributor

@Shaptic Shaptic commented Feb 17, 2026

What

Prefer errors to panics.

Why

While these branches should be impossible to hit under normal circumstances (e.g. a failed unmarshaling would indicate that the Core node is returning invalid XDR), it is still good defensive programming.

Known limitations

n/a

Copilot AI review requested due to automatic review settings February 17, 2026 19:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request improves error handling in the CGo interface by replacing panic calls with proper error logging and returning empty structs to signal errors to the Rust caller. This is a defensive programming improvement that allows errors to be gracefully handled instead of crashing the program when the Core node returns invalid XDR data.

Changes:

  • Replaced two panic calls with error logging and empty struct returns in SnapshotSourceGet function
  • Added error logging for SafeUnmarshal() and MarshalBinary() failures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Shaptic Shaptic requested a review from a team February 18, 2026 00:31
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.

2 participants