Skip to content

Added panic unwinding error handling to give appropriate errors message#532

Merged
MicaiahReid merged 2 commits intosolana-foundation:mainfrom
0xzrf:graceful_shutdown
Feb 27, 2026
Merged

Added panic unwinding error handling to give appropriate errors message#532
MicaiahReid merged 2 commits intosolana-foundation:mainfrom
0xzrf:graceful_shutdown

Conversation

@0xzrf
Copy link
Copy Markdown
Contributor

@0xzrf 0xzrf commented Feb 18, 2026

Summary

This PR fixes a panic in the surfpool completion bash command caused by calling Option::unwrap() on a None value. Instead of crashing, the command now returns an appropriate error message and exits with a non-zero status code.

Closes #531

🔍 What Changed

  • Replace unsafe unwrap() with proper error handling.
  • Return a user-facing error explaining the root cause.
  • Ensure the command exits cleanly on invalid input rather than panicking.

🧪 How to Test

  1. Run:

    surfpool completion bash

Context

The original issue described a panic when running the bash completion command due to an unchecked Option::unwrap(). This caused an abrupt crash without useful feedback to the user. Handling this case explicitly improves stability and user experience. (#531)

Notes

This fix does not add any new features; it improves error safety and observability.

Helps maintain a more robust CLI surface in the Surfpool tool.

Copy link
Copy Markdown
Collaborator

@MicaiahReid MicaiahReid left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @0xzrf

@MicaiahReid MicaiahReid merged commit cc550df into solana-foundation:main Feb 27, 2026
4 checks passed
@0xzrf 0xzrf deleted the graceful_shutdown branch February 27, 2026 13:55
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.

Command panics due to Option::unwrap() instead of returning error

2 participants