Skip to main content

classify_exchange_error_code

Function classify_exchange_error_code 

Source
pub fn classify_exchange_error_code(message: &str) -> &'static str
Expand description

Classify a fetch_exchange_token (or verify_sender_bound_token) failure message into a stable error code for hyprstream-rpc-std::browser_session.

Every input reaches this function only because the exchange already failed (Err) — this is a labeling convenience on top of an already fail-closed exchange, not a gate that could itself fail open. An unrecognized message shape still classifies (as "transport_error"); it is never treated as success.

Classification is substring matching against the exact message shapes those functions produce today — covered by unit tests below against literal message strings so a wording change upstream is caught rather than silently misclassified.