Skip to content

Conversation

@code-inflation
Copy link
Owner

This MR replaces all .expect() and .unwrap() calls with proper error handling throughout the codebase.

Changes Made:

Error Handling Improvements:

  • Server-Timing Header Parsing: Added graceful fallback when header is missing or malformed
  • IP Address Parsing: Added meaningful error messages for invalid IPv4/IPv6 addresses
  • Client Initialization: Added proper error handling for reqwest client builder failures
  • HTTP Request Handling: Added error handling for upload/download request failures

New Tests Added:

  • IP address parsing error handling tests (valid/invalid IPv4/IPv6)
  • Client initialization error handling tests
  • HTTP request failure handling tests
  • Server-Timing header parsing tests (various scenarios)

Benefits:

  • No more panics: Application handles errors gracefully
  • Better UX: Clear error messages instead of cryptic panics
  • More robust: Continues running even when some features fail
  • Better debugging: Log messages help identify issues
  • Production ready: Much more suitable for real-world use

Testing:

  • All existing tests still pass (32 tests)
  • Added 5 new tests for error handling scenarios
  • No clippy warnings
  • Builds successfully in both debug and release modes

Breaking Changes:

None - this is a pure improvement with no API changes.

code-inflation and others added 2 commits December 9, 2025 22:19
- Fix Server-Timing header parsing with graceful fallback
- Fix IP address parsing with meaningful error messages
- Fix client initialization with proper error handling
- Fix HTTP request handling with graceful degradation
- Add comprehensive tests for error handling scenarios
- Add Server-Timing header parsing tests
- Add Default implementation for SpeedTestCLIOptions

The application now handles errors gracefully instead of panicking,
providing better user experience and more robust operation.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@code-inflation code-inflation force-pushed the feature/improved-error-handling branch from 286ff61 to 9223ee9 Compare December 27, 2025 16:29
@code-inflation code-inflation force-pushed the feature/improved-error-handling branch from 9223ee9 to e3b6c21 Compare December 27, 2025 16:57
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