From b33ee5ea8f0d79f69d264982346bd97ca076baa1 Mon Sep 17 00:00:00 2001 From: Afsal Thaj Date: Fri, 26 Jan 2024 15:32:12 +1100 Subject: [PATCH] Make sure http response message is tracked (#52) --- src/clients/worker.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/clients/worker.rs b/src/clients/worker.rs index c6ab601..50eaae3 100644 --- a/src/clients/worker.rs +++ b/src/clients/worker.rs @@ -269,7 +269,22 @@ impl 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();