From 419f27eb9fd3afbbfcd178429693a46225a67dcc Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Thu, 13 Nov 2025 15:04:00 +0900 Subject: [PATCH] =?UTF-8?q?251113=5F02=5FFIX=20:=20ESLINT=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/git_toolbox_prj.xml | 15 +++++++++++++++ .idea/inspectionProfiles/Project_Default.xml | 1 + src/lib/http-client.ts | 20 +++++++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .idea/git_toolbox_prj.xml diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..02b915b --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 03d9549..52ff362 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,6 +1,7 @@ \ No newline at end of file diff --git a/src/lib/http-client.ts b/src/lib/http-client.ts index be1a7a0..52fb1dc 100644 --- a/src/lib/http-client.ts +++ b/src/lib/http-client.ts @@ -191,10 +191,24 @@ export const createHttpClient = (baseURL: string, opts: HttpClientOptions = {}) } return parsed as T; - } catch (err: any) { - // 🔻 여기서 네트워크 레벨 에러 처리 - const code = err?.cause?.code ?? err?.code; + } catch (err: unknown) { + let code: string | undefined; + if (typeof err === "object" && err !== null) { + const anyErr = err as { cause?: unknown; code?: unknown }; + if (anyErr.cause && typeof anyErr.cause === "object") { + const cause = anyErr.cause as { code?: unknown }; + if (typeof cause.code === "string") { + code = cause.code; + } + } + + if (!code && typeof anyErr.code === "string") { + code = anyErr.code; + } + } + + // 🔻 여기서 네트워크 레벨 에러 처리 if (code === "ECONNREFUSED") { // 네트워크 연결 실패 → HttpError(404)로 변환 throw new HttpError(