pub(crate) fn setup_panic_hook()
Expand description
Sets up a comprehensive panic hook that ensures proper terminal restoration.
This function configures a custom panic handler that:
- Immediately disables raw terminal mode
- Exits alternate screen mode
- Clears the terminal display
- Provides user-friendly error messages with context-specific help
- Exits the application cleanly
The panic hook is designed to handle common failure scenarios like:
- Missing environment variables (PROJECT_ID, AWS credentials)
- API authentication failures
- Network connectivity issues
ยงSafety
This function should be called early in main() before any terminal operations to ensure proper cleanup in all failure scenarios.