forked from yagom-academy/ios-diary
-
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.
refactlr: CoreDataError 타입 생성, 예외처리 추가
- Loading branch information
Showing
10 changed files
with
121 additions
and
37 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
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
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,39 @@ | ||
// | ||
// CoreDataError.swift | ||
// Diary | ||
// | ||
// Created by Max, Hemg on 2023/09/10. | ||
// | ||
|
||
enum CoreDataError: Error { | ||
case dataNotFound | ||
case saveFailure | ||
case deleteFailure | ||
case unknown | ||
|
||
var alertTitle: String { | ||
switch self { | ||
case .dataNotFound: | ||
return "로드 실패" | ||
case .saveFailure: | ||
return "저장 실패" | ||
case .deleteFailure: | ||
return "삭제 실패" | ||
case .unknown: | ||
return "오류" | ||
} | ||
} | ||
|
||
var message: String { | ||
switch self { | ||
case .dataNotFound: | ||
return "데이터를 찾지 못했습니다." | ||
case .saveFailure: | ||
return "저장에 실패하였습니다." | ||
case .deleteFailure: | ||
return "삭제에 실패하였습니다." | ||
case .unknown: | ||
return "알 수 없는 오류입니다." | ||
} | ||
} | ||
} |
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