mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
fix: improve error handling in custom model API call
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1511,9 +1511,15 @@ function CompatibleModelsSection({
|
||||
});
|
||||
|
||||
if (!customModelRes.ok) {
|
||||
const errorData = await customModelRes.json().catch(() => ({}));
|
||||
let errorData = {};
|
||||
try {
|
||||
errorData = await customModelRes.json();
|
||||
} catch (jsonError) {
|
||||
console.error("Failed to parse error response from custom model API:", jsonError);
|
||||
}
|
||||
throw new Error(errorData.error?.message || "Failed to save custom model");
|
||||
}
|
||||
}
|
||||
|
||||
// Only create alias after customModel is saved successfully
|
||||
await onSetAlias(modelId, resolvedAlias, providerStorageAlias);
|
||||
|
||||
Reference in New Issue
Block a user