-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor] 에러 핸들링 개선 #35
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ee05aa2
[refactor] NetworkKit 에러 추가 및 개선
around-forest 2b961d3
[refactor] MusicKit 에러 추가
around-forest f7b872e
[refactor] Encoder Error 추가
around-forest 2db0d7b
[refactor] Decoder 에러 추가
around-forest 96f7437
[refactor] AudioKit Error 추가
around-forest f98eb00
[refactor] Repository Error 추가
around-forest 7c9fbee
[refactor] Presentation Layer Error 추가
around-forest 5b13c34
[Refactor] 재사용성 및 가독성을 고려하여 enum을 struct로 변환
around-forest aa75092
[Refactor] #file의 절대경로가 아닌, 에러의 원천 파일명만 출력하도록 수정
around-forest File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,24 @@ | ||
import Foundation | ||
|
||
enum ASAudioErrors: Error, LocalizedError { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LocalizedError가 이미 Error 프로토콜을 채택하고 있습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 모든 케이스가 이유를 가진다면 구조체로 만드는 것은 어땟을지요 ? |
||
case startPlayingError(reason: String) | ||
case getDurationError(reason: String) | ||
case configureAudioSessionError(reason: String) | ||
case startRecordingError(reason: String) | ||
case analyzeError(reason: String) | ||
|
||
var errorDescription: String? { | ||
switch self { | ||
case .startPlayingError(let reason): | ||
return "ASAudioPlayer.swift startPlaying() 에러: 오디오 객체 생성에 실패했습니다.\n\(reason)" | ||
case .getDurationError(let reason): | ||
return "ASAudioPlayer.swift getDuration() 에러: 오디오 객체 생성에 실패했습니다.\n\(reason)" | ||
case .configureAudioSessionError(let reason): | ||
return "confitureAudioSession() 에러: 세션 설정에 실패했습니다.\n\(reason)" | ||
case .startRecordingError(let reason): | ||
return "ASAudioRecorder.swift startRecording() 에러: 오디오 레코더 객체 생성에 실패했습니다.\n\(reason)" | ||
case .analyzeError(let reason): | ||
return "ASAudioAnalyzer.swift analyze() 에러: 오디오 분석에 실패했습니다.\n\(reason)" | ||
} | ||
} | ||
} |
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,12 @@ | ||
import Foundation | ||
|
||
enum ASDecoderErrors: Error, LocalizedError { | ||
case decodeError(reason: String) | ||
|
||
var errorDescription: String? { | ||
switch self { | ||
case .decodeError(let reason): | ||
return "ASDecoder.swift decode() 에러: 데이터 디코딩 중 오류가 발생했습니다.\n\(reason)" | ||
} | ||
} | ||
} |
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 Foundation | ||
|
||
enum ASEncoderErrors: Error, LocalizedError { | ||
case encodeError(reason: String) | ||
|
||
var errorDescription: String? { | ||
switch self { | ||
case .encodeError(let reason): | ||
return "ASEncoder.swift encode() 에러: 데이터 인코딩 중 오류가 발생했습니다.\n\(reason)" | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요 건우님, 잘 지내고 계신가요 ? 잠깐 구경 왔습니다.
음성 파일을 분석하는 코드를 꼼꼼히 잘 짜주셨는데, 너무 길이가 길지 않나요 ?
데이터를 파일로 쓰는 부분, 파일로 쓴 데이터를 읽어와 청크 단위로 분석하는 부분을 나누면 어떤가요 ?
가독성이 더 올라갈 수 있을 것 같습니다.
궁금한 점이 있다면 데이터를 파일로 변환한 다음에 분석해야하는 이유가 있나요 ?