This commit is contained in:
John Smith 2022-06-29 19:20:25 -04:00
parent 97b5fad9f1
commit 4357358ec6
2 changed files with 4 additions and 5 deletions

View File

@ -78,8 +78,8 @@ where
pub async fn recv(&self) -> Result<Vec<u8>, String> {
let out = match self.stream.clone().next().await {
Some(Ok(Message::Binary(v))) => v,
Some(Ok(_)) => {
return Err("Unexpected WS message type".to_owned()).map_err(logthru_net!(error));
Some(Ok(x)) => {
return Err(format!("Unexpected WS message type: {:?}", x));
}
Some(Err(e)) => {
return Err(e.to_string()).map_err(logthru_net!(error));

View File

@ -56,9 +56,8 @@ impl WebsocketNetworkConnection {
pub async fn recv(&self) -> Result<Vec<u8>, String> {
let out = match self.inner.ws_stream.clone().next().await {
Some(WsMessage::Binary(v)) => v,
Some(_) => {
return Err("Unexpected WS message type".to_owned())
.map_err(logthru_net!(error));
Some(x) => {
return Err(format!("Unexpected WS message type: {:?}", x));
}
None => {
return Err("WS stream closed".to_owned()).map_err(logthru_net!(error));