Improve Supabase error reporting for diagnostic purposes

This commit is contained in:
Christian Vidal Wolf
2026-04-10 12:06:16 +02:00
parent ee73b85100
commit db91aeb842
2 changed files with 29 additions and 13 deletions
+5 -5
View File
@@ -327,10 +327,10 @@ export default function App() {
try {
for (const [articleNo, { newData, originalData, articleName }] of entries) {
console.log('[handleSaveAll] Saving article:', articleNo);
const success = await saveRowToSupabase(articleNo, newData, token);
console.log('[handleSaveAll] Save result for', articleNo, ':', success);
const result = await saveRowToSupabase(articleNo, newData, token);
console.log('[handleSaveAll] Save result for', articleNo, ':', result);
if (success) {
if (result.success) {
// Also save to history
await saveHistoryEntry(articleNo, articleName, originalData, newData, session?.user?.email || 'unknown', token);
@@ -342,14 +342,14 @@ export default function App() {
});
} else {
setRowStatuses(prev => ({ ...prev, [articleNo]: 'error' }));
failedArticles.push(articleNo);
failedArticles.push(`${articleNo} [${result.error || 'Unknown error'}]`);
}
}
console.log('[handleSaveAll] Finished loop. Failed:', failedArticles.length);
if (failedArticles.length > 0) {
alert(`Failed to save ${failedArticles.length} items: ${failedArticles.join(', ')}. Please try again.`);
alert(`Failed to save items:\n\n${failedArticles.join('\n')}\n\nPlease try again.`);
} else {
setAppState(prev => ({ ...prev, hasUnsavedChanges: false }));
}