diff --git a/src/app/error.jsx b/src/app/error.jsx index 07d75e7e..8778a3dd 100644 --- a/src/app/error.jsx +++ b/src/app/error.jsx @@ -1,6 +1,16 @@ 'use client' export default function ServerError() { + // Log 500 error details to console + if (typeof window !== 'undefined') { + console.error('🚨 500 Server Error Page Rendered:', { + timestamp: new Date().toISOString(), + userAgent: navigator.userAgent, + url: window.location.href, + referrer: document.referrer + }) + } + return (
@@ -8,6 +18,9 @@ export default function ServerError() {

500

Internal Server Error.

We are already working to solve the problem.

+

+ Check the browser console for detailed error information. +

diff --git a/src/app/layout.js b/src/app/layout.js index e19c6bb7..40386d49 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -9,6 +9,7 @@ import GlobalDataProvider from './GlobalDataProvider' import Header from '@/components/header/Header' import QModal from '@/components/common/modal/QModal' import PopupManager from '@/components/common/popupManager/PopupManager' +import ErrorBoundary from '@/components/common/ErrorBoundary' import './globals.css' import '../styles/style.scss' @@ -69,26 +70,28 @@ export default async function RootLayout({ children }) { return ( - - - {headerPathname === '/login' || headerPathname === '/join' ? ( - {children} - ) : ( - - -
-
-
- {children} + + + + {headerPathname === '/login' || headerPathname === '/join' ? ( + {children} + ) : ( + + +
+
+
+ {children} +
+
-
-
- - - - )} - - + + + + )} + + + ) diff --git a/src/components/main/MainContents.jsx b/src/components/main/MainContents.jsx index 6d6ccd82..f20bfaf7 100644 --- a/src/components/main/MainContents.jsx +++ b/src/components/main/MainContents.jsx @@ -55,12 +55,26 @@ export default function MainContents({ setFaqOpen, setFaqModalNoticeNo }) { }) const apiUrl = `${url}?${params.toString()}` - const resultData = await get({ url: apiUrl }) + + try { + const resultData = await get({ url: apiUrl }) - if (resultData) { - if (resultData.result.code === 200) { - setFileList(resultData.data) + if (resultData) { + if (resultData.result.code === 200) { + setFileList(resultData.data) + } } + } catch (error) { + console.error('🚨 ARCHIVE fetching error:', { + error, + timestamp: new Date().toISOString(), + apiUrl, + params: Object.fromEntries(params), + status: error.response?.status, + statusText: error.response?.statusText, + message: error.message, + stack: error.stack + }) } } @@ -82,7 +96,16 @@ export default function MainContents({ setFaqOpen, setFaqModalNoticeNo }) { } }) } catch (error) { - console.error('NOTICE fetching error:', error) + console.error('🚨 NOTICE fetching error:', { + error, + timestamp: new Date().toISOString(), + apiUrl: noticeApiUrl, + params: param, + status: error.response?.status, + statusText: error.response?.statusText, + message: error.message, + stack: error.stack + }) } } @@ -106,7 +129,16 @@ export default function MainContents({ setFaqOpen, setFaqModalNoticeNo }) { } }) } catch (error) { - console.error('FAQ fetching error:', error) + console.error('🚨 FAQ fetching error:', { + error, + timestamp: new Date().toISOString(), + apiUrl: faqApiUrl, + params: param, + status: error.response?.status, + statusText: error.response?.statusText, + message: error.message, + stack: error.stack + }) } } diff --git a/src/hooks/main/useMainContentsController.js b/src/hooks/main/useMainContentsController.js index 1938a37a..d618d27e 100644 --- a/src/hooks/main/useMainContentsController.js +++ b/src/hooks/main/useMainContentsController.js @@ -53,7 +53,20 @@ export const useMainContentsController = () => { }) } catch (error) { setIsGlobalLoading(false) - console.error('MAIN API fetching error:', error) + console.error('🚨 MAIN API fetching error:', { + error, + timestamp: new Date().toISOString(), + apiUrl, + session: { + storeId: session?.storeId, + userId: session?.userId, + builderNo: session?.builderNo + }, + status: error.response?.status, + statusText: error.response?.statusText, + message: error.message, + stack: error.stack + }) } } diff --git a/src/hooks/useAxios.js b/src/hooks/useAxios.js index b4b9652d..a5c1708a 100644 --- a/src/hooks/useAxios.js +++ b/src/hooks/useAxios.js @@ -38,13 +38,65 @@ export function useAxios(lang = '') { }) // response μΆ”κ°€ 둜직 - axios.interceptors.request.use(undefined, (error) => {}) + axios.interceptors.response.use( + (response) => { + // 500 μ—λŸ¬ λ‘œκΉ… + if (response.status === 500) { + console.error('🚨 500 Error Response:', { + url: response.config.url, + method: response.config.method, + status: response.status, + statusText: response.statusText, + timestamp: new Date().toISOString(), + requestData: response.config.data, + responseData: response.data + }) + } + return response + }, + (error) => { + // 500 μ—λŸ¬ 및 기타 μ—λŸ¬ λ‘œκΉ… + if (error.response?.status === 500) { + console.error('🚨 500 Error Caught:', { + url: error.config?.url, + method: error.config?.method, + status: error.response?.status, + statusText: error.response?.statusText, + timestamp: new Date().toISOString(), + requestData: error.config?.data, + errorMessage: error.message, + errorStack: error.stack + }) + } else { + console.error('🚨 API Error:', { + url: error.config?.url, + method: error.config?.method, + status: error.response?.status, + statusText: error.response?.statusText, + timestamp: new Date().toISOString(), + errorMessage: error.message + }) + } + return Promise.reject(error) + } + ) const get = async ({ url, option = {} }) => { return await getInstances(url) .get(url, option) .then((res) => res.data) - .catch(console.error) + .catch((error) => { + console.error('🚨 GET Error:', { + url, + method: 'GET', + timestamp: new Date().toISOString(), + errorMessage: error.message, + status: error.response?.status, + statusText: error.response?.statusText, + config: error.config + }) + throw error + }) } const promiseGet = async ({ url, option = {} }) => { @@ -55,7 +107,19 @@ export function useAxios(lang = '') { return await getInstances(url) .post(url, data, option) .then((res) => res.data) - .catch(console.error) + .catch((error) => { + console.error('🚨 POST Error:', { + url, + method: 'POST', + timestamp: new Date().toISOString(), + errorMessage: error.message, + status: error.response?.status, + statusText: error.response?.statusText, + requestData: data, + config: error.config + }) + throw error + }) } const promisePost = async ({ url, data, option = {} }) => { @@ -66,7 +130,19 @@ export function useAxios(lang = '') { return await getInstances(url) .put(url, data, option) .then((res) => res.data) - .catch(console.error) + .catch((error) => { + console.error('🚨 PUT Error:', { + url, + method: 'PUT', + timestamp: new Date().toISOString(), + errorMessage: error.message, + status: error.response?.status, + statusText: error.response?.statusText, + requestData: data, + config: error.config + }) + throw error + }) } const promisePut = async ({ url, data, option = {} }) => { @@ -77,7 +153,19 @@ export function useAxios(lang = '') { return await getInstances(url) .patch(url, data, option) .then((res) => res.data) - .catch(console.error) + .catch((error) => { + console.error('🚨 PATCH Error:', { + url, + method: 'PATCH', + timestamp: new Date().toISOString(), + errorMessage: error.message, + status: error.response?.status, + statusText: error.response?.statusText, + requestData: data, + config: error.config + }) + throw error + }) } const promisePatch = async ({ url, data, option = {} }) => { @@ -88,7 +176,18 @@ export function useAxios(lang = '') { return await getInstances(url) .delete(url, option) .then((res) => res.data) - .catch(console.error) + .catch((error) => { + console.error('🚨 DELETE Error:', { + url, + method: 'DELETE', + timestamp: new Date().toISOString(), + errorMessage: error.message, + status: error.response?.status, + statusText: error.response?.statusText, + config: error.config + }) + throw error + }) } const promiseDel = async ({ url, option = {} }) => {