-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[공통] ERROR 컨벤션 지정
- Loading branch information
Showing
5 changed files
with
70 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AxiosError } from 'axios'; | ||
|
||
export interface KoinError { | ||
type: 'KOIN_ERROR'; | ||
status: number; | ||
code: number; | ||
message: string; | ||
} | ||
|
||
export interface CustomAxiosError extends AxiosError { | ||
type: 'AXIOS_ERROR'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { KoinError } from 'model/error'; | ||
|
||
export function isKoinError(error: unknown): error is KoinError { | ||
try { | ||
// 코인 서버 에러인지 아닌지를 확인 | ||
return (error as KoinError).type === 'KOIN_ERROR'; | ||
} catch { | ||
return false; | ||
} | ||
} |