Implement Phase 3C error logging

This commit is contained in:
gpt-engineer-app[bot]
2025-11-04 19:39:55 +00:00
parent 162d288cb0
commit a9334c7a3a
13 changed files with 179 additions and 210 deletions

View File

@@ -4,7 +4,7 @@
*/
import { supabase } from '@/lib/supabaseClient';
import { logger } from './logger';
import { handleNonCriticalError } from './errorHandler';
/**
* Write admin audit details to relational table
@@ -27,7 +27,10 @@ export async function writeAdminAuditDetails(
.insert(entries);
if (error) {
logger.error('Failed to write admin audit details', { error, auditLogId });
handleNonCriticalError(error, {
action: 'Write admin audit details',
metadata: { auditLogId },
});
throw error;
}
}
@@ -53,7 +56,10 @@ export async function writeModerationAuditMetadata(
.insert(entries);
if (error) {
logger.error('Failed to write moderation audit metadata', { error, auditLogId });
handleNonCriticalError(error, {
action: 'Write moderation audit metadata',
metadata: { auditLogId },
});
throw error;
}
}
@@ -84,7 +90,10 @@ export async function writeItemChangeFields(
.insert(entries);
if (error) {
logger.error('Failed to write item change fields', { error, editHistoryId });
handleNonCriticalError(error, {
action: 'Write item change fields',
metadata: { editHistoryId },
});
throw error;
}
}
@@ -118,7 +127,10 @@ export async function writeRequestBreadcrumbs(
.insert(entries);
if (error) {
logger.error('Failed to write request breadcrumbs', { error, requestId });
handleNonCriticalError(error, {
action: 'Write request breadcrumbs',
metadata: { requestId },
});
throw error;
}
}
@@ -135,7 +147,10 @@ export async function readAdminAuditDetails(
.eq('audit_log_id', auditLogId);
if (error) {
logger.error('Failed to read admin audit details', { error, auditLogId });
handleNonCriticalError(error, {
action: 'Read admin audit details',
metadata: { auditLogId },
});
return {};
}
@@ -157,7 +172,10 @@ export async function readModerationAuditMetadata(
.eq('audit_log_id', auditLogId);
if (error) {
logger.error('Failed to read moderation audit metadata', { error, auditLogId });
handleNonCriticalError(error, {
action: 'Read moderation audit metadata',
metadata: { auditLogId },
});
return {};
}
@@ -179,7 +197,10 @@ export async function readItemChangeFields(
.eq('edit_history_id', editHistoryId);
if (error) {
logger.error('Failed to read item change fields', { error, editHistoryId });
handleNonCriticalError(error, {
action: 'Read item change fields',
metadata: { editHistoryId },
});
return {};
}
@@ -218,7 +239,10 @@ export async function writeProfileChangeFields(
.insert(entries);
if (error) {
logger.error('Failed to write profile change fields', { error, auditLogId });
handleNonCriticalError(error, {
action: 'Write profile change fields',
metadata: { auditLogId },
});
throw error;
}
}
@@ -252,7 +276,10 @@ export async function writeConflictDetailFields(
.insert(entries);
if (error) {
logger.error('Failed to write conflict detail fields', { error, conflictResolutionId });
handleNonCriticalError(error, {
action: 'Write conflict detail fields',
metadata: { conflictResolutionId },
});
throw error;
}
}