feat(ui): alert when adding model without STORE_MODEL_IN_DB (#8591)

This commit show user-friendly error using message.error when a
model is added via the UI and STORE_MODEL_IN_DB is not True.

Fixes: #8516.
This commit is contained in:
Aditya Kumar Kasaudhan 2025-02-18 04:24:53 +05:30 committed by GitHub
parent 9a356c2bf8
commit a161f51cfa

View file

@ -111,9 +111,12 @@ export const modelCreateCall = async (
});
if (!response.ok) {
const errorData = await response.text();
console.error("Error response from the server:", errorData);
throw new Error("Network response was not ok");
const errorData = await response.json();
const errorMsg =
errorData.error?.message?.error ||
"Network response was not ok";
message.error(errorMsg);
throw new Error(errorMsg);
}
const data = await response.json();