improved error handling for adding an item

This commit is contained in:
2025-09-30 13:03:00 +02:00
parent 8f9696991f
commit bf36a6605f
2 changed files with 8 additions and 2 deletions

View File

@@ -148,7 +148,11 @@ export const createItem = async (
body: JSON.stringify({ item_name, can_borrow_role }),
});
if (!response.ok) {
throw new Error("Failed to create item");
return {
success: false,
message:
"Fehler beim Erstellen des Gegenstands. Der Name des Gegenstandes darf nicht mehrmals vergeben werden.",
};
}
return { success: true };
} catch (error) {