Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Make sure http response message is tracked (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
afsalthaj committed Jan 26, 2024
1 parent d8de8ca commit b33ee5e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/clients/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,22 @@ impl<C: golem_client::api::WorkerClient + Sync + Send> WorkerClient for WorkerCl

let (ws_stream, _) = connect_async_tls_with_config(request, None, false, connector)
.await
.map_err(|e| GolemError(format!("Failed websocket: {e}")))?;
.map_err(|e| match e {
tungstenite::error::Error::Http(http_error_response) => {
match http_error_response.body().clone() {
Some(body) => GolemError(format!(
"Failed Websocket. Http error: {}, {}",
http_error_response.status(),
String::from_utf8_lossy(&body)
)),
None => GolemError(format!(
"Failed Websocket. Http error: {}",
http_error_response.status()
)),
}
}
_ => GolemError(format!("Failed Websocket. Error: {}", e)),
})?;

let (mut write, read) = ws_stream.split();

Expand Down

0 comments on commit b33ee5e

Please sign in to comment.