Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(websocket): Simplify error handling and improve code readability #418

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

0x676e67
Copy link
Owner

@0x676e67 0x676e67 commented Feb 9, 2025

This pull request includes several changes to the src/client/websocket/mod.rs and src/error.rs files to simplify error handling and improve code readability. The most important changes include consolidating error imports, refactoring error creation, and modifying error handling in the WebSocketResponse and WebSocket implementations.

Improvements to error handling and code readability:

  • src/client/websocket/mod.rs: Consolidated imports from crate::error and moved pub use message::{CloseCode, CloseFrame, Message, Utf8Bytes}; to the top of the file.
  • src/client/websocket/mod.rs: Refactored error creation in WebSocketRequestBuilder to use the new error::upgrade function.
  • src/client/websocket/mod.rs: Modified WebSocketResponse to use error::upgrade for various error conditions, improving consistency and readability. [1] [2] [3]
  • src/client/websocket/mod.rs: Updated Stream implementation for WebSocket to use error::body for error handling.
  • src/error.rs: Added a new upgrade function for creating upgrade errors and removed the redundant upgrade function definition. [1] [2]

@0x676e67 0x676e67 merged commit 60fa74d into main Feb 9, 2025
4 checks passed
@0x676e67 0x676e67 deleted the chore branch February 9, 2025 13:12
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.

1 participant