From 0ae29310ee63394fc0f906848bcc4b6a05303bb2 Mon Sep 17 00:00:00 2001 From: HugoCasa Date: Wed, 29 Nov 2023 00:24:56 +0100 Subject: [PATCH] fix: better error for moved openai resource (#2724) * fix: better error for moved openai resource * fix: nit --- backend/windmill-api/src/openai.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/windmill-api/src/openai.rs b/backend/windmill-api/src/openai.rs index ce9a21937c..7bfa926ee5 100644 --- a/backend/windmill-api/src/openai.rs +++ b/backend/windmill-api/src/openai.rs @@ -102,9 +102,13 @@ async fn proxy( &openai_resource_path, &w_id ) - .fetch_one(&mut *tx) - .await?; - tx.commit().await?; + .fetch_optional(&mut *tx) + .await? + .ok_or_else(|| { + create_openai_json_error(format!( + "Could not find the OpenAI resource at path {openai_resource_path}, update the resource path in the workspace settings" + )) + })?; if resource.is_none() { return Err(create_openai_json_error(