diff --git a/src/api/index.ts b/src/api/index.ts index 77d3aa8e..4bc1c746 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -64,14 +64,14 @@ function createKoinErrorFromAxiosError(error: AxiosError): KoinError if (isAxiosErrorWithResponseData(error)) { const koinError = error.response!; return { - type: 'koin-error', + type: 'KOIN_ERROR', status: koinError.status, code: koinError.data.code, message: koinError.data.message, }; } return { - type: 'axios-error', + type: 'AXIOS_ERROR', ...error, }; } diff --git a/src/model/error/index.ts b/src/model/error/index.ts index 60926a28..ecf34591 100644 --- a/src/model/error/index.ts +++ b/src/model/error/index.ts @@ -1,12 +1,12 @@ import { AxiosError } from 'axios'; export interface KoinError { - type: 'koin-error'; + type: 'KOIN_ERROR'; status: number; code: number; message: string; } export interface CustomAxiosError extends AxiosError { - type: 'axios-error'; + type: 'AXIOS_ERROR'; } diff --git a/src/utils/ts/isKoinError.ts b/src/utils/ts/isKoinError.ts index 04642db7..f3efde8a 100644 --- a/src/utils/ts/isKoinError.ts +++ b/src/utils/ts/isKoinError.ts @@ -3,7 +3,7 @@ import { KoinError } from 'model/error'; export function isKoinError(error: unknown): error is KoinError { try { // 코인 서버 에러인지 아닌지를 확인 - return (error as KoinError).type === 'koin-error'; + return (error as KoinError).type === 'KOIN_ERROR'; } catch { return false; }