feat: Complete app-wide error coverage

This commit is contained in:
gpt-engineer-app[bot]
2025-11-04 19:58:20 +00:00
parent d9bd7c1616
commit a649906b61
22 changed files with 111 additions and 57 deletions

View File

@@ -75,8 +75,7 @@ import { DialogFooter } from '@/components/ui/dialog';
import { useTheme } from '@/components/theme/ThemeProvider';
import { useUserRole } from '@/hooks/useUserRole';
import { useDocumentTitle } from '@/hooks/useDocumentTitle';
import { handleError, handleSuccess } from '@/lib/errorHandler';
import { logger } from '@/lib/logger';
import { handleError, handleSuccess, handleNonCriticalError } from '@/lib/errorHandler';
import { contactCategories } from '@/lib/contactValidation';
import { invokeWithTracking } from '@/lib/edgeFunctionTracking';
import { AdminLayout } from '@/components/layout/AdminLayout';
@@ -199,7 +198,10 @@ export default function AdminContact() {
const { data, error } = await query;
if (error) {
logger.error('Failed to fetch contact submissions', { error: error.message });
handleNonCriticalError(error, {
action: 'Fetch contact submissions',
metadata: { error: error.message }
});
throw error;
}
@@ -219,7 +221,10 @@ export default function AdminContact() {
.order('created_at', { ascending: true })
.then(({ data, error }) => {
if (error) {
logger.error('Failed to fetch email threads', { error });
handleNonCriticalError(error, {
action: 'Fetch email threads',
metadata: { submissionId: selectedSubmission.id }
});
setEmailThreads([]);
} else {
setEmailThreads((data as EmailThread[]) || []);
@@ -263,7 +268,10 @@ export default function AdminContact() {
.eq('id', submissionId);
if (statusError) {
logger.error('Failed to update status', { error: statusError });
handleError(statusError, {
action: 'Update contact status',
metadata: { submissionId, newStatus }
});
throw statusError;
}
}
@@ -465,8 +473,10 @@ export default function AdminContact() {
.order('created_at', { ascending: true })
.then(({ data, error }) => {
if (error) {
logger.error('Failed to refresh email threads', { error });
handleError(error, { action: 'Refresh Email Threads' });
handleError(error, {
action: 'Refresh Email Threads',
metadata: { submissionId: selectedSubmission.id }
});
} else {
setEmailThreads((data as EmailThread[]) || []);
handleSuccess('Refreshed', 'Email thread updated');