mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-26 12:27:01 -05:00
feat: Complete app-wide error coverage
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user