mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
ui add health/test_connection
This commit is contained in:
parent
f62acaa7eb
commit
c28de33623
1 changed files with 9 additions and 4 deletions
|
@ -2304,17 +2304,22 @@ export const testConnectionRequest = async (
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
if (!response.ok || data.status === "error") {
|
if (!response.ok || data.status === "error") {
|
||||||
// Handle the specific error format you're receiving
|
// Return the error response instead of throwing an error
|
||||||
if (data.status === "error" && data.result && data.result.error) {
|
// This allows the caller to handle the error format properly
|
||||||
throw new Error(data.result.error);
|
if (data.status === "error") {
|
||||||
|
return data; // Return the full error response
|
||||||
} else {
|
} 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;
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Model connection test error:", error);
|
console.error("Model connection test error:", error);
|
||||||
|
// For network errors or other exceptions, still throw
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue