-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor]#71 UserAPI URL Session으로 변경
- Loading branch information
Showing
4 changed files
with
138 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// NetworkError.swift | ||
// Keyneez | ||
// | ||
// Created by 최효원 on 2023/02/27. | ||
// | ||
|
||
import Foundation | ||
|
||
enum NetworkError: LocalizedError { | ||
case unknownError | ||
case invalidStatusCode(Int) | ||
case invalidResponse(Error) | ||
case components | ||
case badRequest(Error) | ||
case parsing(Error) | ||
case emptyData | ||
case decodeError | ||
|
||
var errorDescription: String? { | ||
switch self { | ||
case .unknownError: return "알수 없는 에러입니다." | ||
case .invalidStatusCode: return "status코드가 200~299가 아닙니다." | ||
case .invalidResponse: return "잘못된 응답입니다." | ||
case .components: return "components를 생성 에러가 발생했습니다." | ||
case .badRequest: return "URL request 관련 에러가 발생했습니다." | ||
case .parsing: return "데이터 parsing 중에 에러가 발생했습니다." | ||
case .emptyData: return "data가 비어있습니다." | ||
case .decodeError: return "decode 에러가 발생했습니다." | ||
} | ||
} | ||
} |
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