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:
Nyaru Toru
2026-02-24 21:29:21 +07:00
committed by GitHub
parent c8989ddead
commit bf49fdf0bf

View File

@@ -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);