diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index 0ca1ea0..3168521 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -1,4 +1,5 @@ import axios, { AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig } from 'axios'; +import { logError } from '@/utils/errorLogger'; export interface ApiError { status: number; @@ -114,6 +115,18 @@ apiClient.interceptors.response.use( validationErrors: status === 422 ? extractValidationErrors(data) : undefined, }; + // Report API errors to backend error logger (for Forgejo issue creation) + // Skip 401 (auth) and 403 (permission) — these are expected, not bugs + // Report: 422 (validation), 404 (not found), 5xx (server), 0 (network) + if (status !== 401 && status !== 403) { + logError(apiError.message, { + status, + url: error.config?.url, + method: error.config?.method, + detail: apiError.detail, + }); + } + return Promise.reject(apiError); } ); diff --git a/frontend/src/components/ErrorBoundary.tsx b/frontend/src/components/ErrorBoundary.tsx index 0ed1434..f7eccc1 100644 --- a/frontend/src/components/ErrorBoundary.tsx +++ b/frontend/src/components/ErrorBoundary.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { logError } from '@/utils/errorLogger'; interface ErrorBoundaryProps { children: React.ReactNode; @@ -26,6 +27,7 @@ export class ErrorBoundary extends React.Component {