From 40779f8ff2f100459c02b56cf42ca4e8e0e99490 Mon Sep 17 00:00:00 2001 From: Alexander Petric Date: Tue, 1 Jul 2025 09:45:04 -0400 Subject: [PATCH] improve graphql error reporting (#6092) --- backend/windmill-worker/src/graphql_executor.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/backend/windmill-worker/src/graphql_executor.rs b/backend/windmill-worker/src/graphql_executor.rs index d9117adb53..b5a3aadc3d 100644 --- a/backend/windmill-worker/src/graphql_executor.rs +++ b/backend/windmill-worker/src/graphql_executor.rs @@ -10,9 +10,9 @@ use windmill_queue::{CanceledBy, MiniPulledJob}; use serde::Deserialize; +use crate::common::build_args_map; use crate::common::{build_http_client, resolve_job_timeout, OccupancyMetrics}; use crate::handle_child::run_future_with_polling_update_job_poller; -use crate::common::build_args_map; use windmill_common::client::AuthedClient; #[derive(Deserialize)] @@ -107,6 +107,20 @@ pub async fn do_graphql( .await .map_err(|e| Error::ExecutionErr(e.to_string()))?; + // Check HTTP status before processing response + if !response.status().is_success() { + let status = response.status(); + let error_body = response + .text() + .await + .unwrap_or_else(|_| "Failed to read error response".to_string()); + return Err(Error::ExecutionErr(format!( + "GraphQL request failed with HTTP {}: {}", + status.as_u16(), + error_body + ))); + } + let result_stream = response.bytes_stream(); let mut i = 0;