Skip to content

Commit

Permalink
fix: error type 상수 컨벤션으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hanagertrudeKim committed Mar 28, 2024
1 parent 1dd5cb0 commit c36d074
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ function createKoinErrorFromAxiosError(error: AxiosError<KoinError>): 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,
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/model/error/index.ts
Original file line number Diff line number Diff line change
@@ -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';
}
2 changes: 1 addition & 1 deletion src/utils/ts/isKoinError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c36d074

Please sign in to comment.