@@ -28,9 +28,16 @@ public void analyze(String githubUrl) {
2828 String repo = repoInfo [1 ];
2929
3030 // Repository 데이터 수집
31- RepositoryData repositoryData = repositoryService .fetchAndSaveRepository (owner , repo );
31+ RepositoryData repositoryData ;
32+
33+ try {
34+ repositoryData = repositoryService .fetchAndSaveRepository (owner , repo );
35+ log .info ("🫠 Repository Data 수집 완료: {}" , repositoryData );
36+ } catch (BusinessException e ) {
37+ log .error ("Repository 데이터 수집 실패: {}/{}" , owner , repo , e );
38+ throw handleRepositoryFetchError (e , owner , repo );
39+ }
3240
33- log .info ("🫠 ResponseData: {}" , repositoryData );
3441 // TODO: AI 평가
3542 // EvaluationResult evaluation = evaluationService.evaluate(repositoryData);
3643
@@ -62,6 +69,16 @@ private String[] parseGitHubUrl(String githubUrl) {
6269 return new String []{parts [0 ].trim (), parts [1 ].trim ()};
6370 }
6471
72+ private BusinessException handleRepositoryFetchError (BusinessException e , String owner , String repo ) {
73+ return switch (e .getErrorCode ()) {
74+ case GITHUB_REPO_NOT_FOUND ->
75+ new BusinessException (ErrorCode .GITHUB_REPO_NOT_FOUND );
76+ case GITHUB_RATE_LIMIT_EXCEEDED ->
77+ new BusinessException (ErrorCode .GITHUB_RATE_LIMIT_EXCEEDED );
78+ default -> e ;
79+ };
80+ }
81+
6582 // AnalysisRresult에서 repository id로 분석 결과 찾기
6683 public Optional <AnalysisResult > findByRepositoryId (Long RepositoryId ) {
6784 return analysisResultRepository .findByRepositoriesId (RepositoryId );
0 commit comments