From 8cfd2e65cf3f19d332c62efe6723670e038fdd6e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 14 Mar 2025 12:26:41 -0700 Subject: [PATCH] ui add health/test_connection --- ui/litellm-dashboard/src/components/networking.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index 1603d2ae26..d4de7aad82 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -2304,17 +2304,22 @@ export const testConnectionRequest = async ( const data = await response.json(); if (!response.ok || data.status === "error") { - // Handle the specific error format you're receiving - if (data.status === "error" && data.result && data.result.error) { - throw new Error(data.result.error); + // Return the error response instead of throwing an error + // This allows the caller to handle the error format properly + if (data.status === "error") { + return data; // Return the full error response } else { - throw new Error(data.error?.message || `Connection test failed: ${response.status} ${response.statusText}`); + return { + status: "error", + message: data.error?.message || `Connection test failed: ${response.status} ${response.statusText}` + }; } } return data; } catch (error) { console.error("Model connection test error:", error); + // For network errors or other exceptions, still throw throw error; } };