Skip to content

fix(cable): preserve I/O error kind on the WebSocket data channel#218

Merged
AlfioEmanueleFresta merged 1 commit into
masterfrom
feat/pxp-ble-ws-error-kind
May 18, 2026
Merged

fix(cable): preserve I/O error kind on the WebSocket data channel#218
AlfioEmanueleFresta merged 1 commit into
masterfrom
feat/pxp-ble-ws-error-kind

Conversation

@AlfioEmanueleFresta
Copy link
Copy Markdown
Member

@AlfioEmanueleFresta AlfioEmanueleFresta commented May 17, 2026

Summary

  • Map tungstenite::Error::Io to TransportError::IoError(kind) in WebSocketDataChannel::{send, recv}, matching L2capDataChannel's variant strategy so the CableDataChannel trait abstraction lets callers differentiate failure modes regardless of transport.
  • Treat tungstenite::Error::ConnectionClosed as a clean close in recv (returns Ok(None)), matching how Message::Close is already handled.
  • Protocol-level issues (unexpected message type, Tls, Capacity, Protocol, Utf8, Url, Http, AlreadyClosed, etc.) still map to TransportError::ConnectionFailed.

Stacked on top of #216.

Test plan

  • cargo build --workspace --all-features
  • cargo clippy --workspace --all-features --all-targets -- -D warnings
  • cargo test --workspace --all-features --lib (258 passed)
  • cargo fmt --all -- --check

@AlfioEmanueleFresta AlfioEmanueleFresta marked this pull request as ready for review May 17, 2026 16:59
Copy link
Copy Markdown
Collaborator

@msirringhaus msirringhaus left a comment

Choose a reason for hiding this comment

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

lgtm

Base automatically changed from feat/pxp-ble to master May 18, 2026 18:55
Map tungstenite::Error::Io to TransportError::IoError(kind), matching
the L2capDataChannel variant strategy so the CableDataChannel trait is
useful for differentiating failure modes regardless of transport.
Treat Error::ConnectionClosed as a clean close in recv to match the
existing handling of Message::Close. Protocol-level errors still map
to ConnectionFailed.
@AlfioEmanueleFresta AlfioEmanueleFresta force-pushed the feat/pxp-ble-ws-error-kind branch from fe83184 to 3a701bf Compare May 18, 2026 19:09
@AlfioEmanueleFresta AlfioEmanueleFresta merged commit 24d874a into master May 18, 2026
1 check passed
@AlfioEmanueleFresta AlfioEmanueleFresta deleted the feat/pxp-ble-ws-error-kind branch May 18, 2026 19:09
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