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 5f6f62a34f
commit 0839880f4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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