From dbbdbc657000637120c6d45b67dfa41f770969a4 Mon Sep 17 00:00:00 2001 From: ejinn1 Date: Thu, 1 May 2025 17:18:03 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=97=90=EB=9F=AC=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=20=EC=A4=91=EB=B3=B5=20=ED=98=84=EC=83=81=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/services/httpMethod.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/apis/services/httpMethod.ts b/src/apis/services/httpMethod.ts index 06e737f..24e8774 100644 --- a/src/apis/services/httpMethod.ts +++ b/src/apis/services/httpMethod.ts @@ -1,5 +1,6 @@ +import { AxiosError } from 'axios'; + import axiosInstance, { setAuthToken } from '@/lib/axiosInstance'; -import { handleHttpError } from '@/utils/handleHttpError'; type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'; @@ -29,8 +30,14 @@ async function request({ return response.data; } catch (error) { - handleHttpError(error); - throw error; + if (!(error instanceof AxiosError)) { + throw new Error('오류가 발생했습니다.'); + } + + const status = error.response?.status; + const message = error.response?.data.message || error.message; + + throw new Error(JSON.stringify({ status, message })); } }