Skip to content

Commit

Permalink
Merge pull request #50 from MAKAR-iOS/feat/#49
Browse files Browse the repository at this point in the history
[Feat/#49] 최근 경로 리스트 내 존재하지 않는 경로를 삭제할 경우 예외 처리
  • Loading branch information
chaeyeon0130 authored Jul 30, 2024
2 parents 722049d + a168843 commit 847cf14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/makar/dev/common/status/ErrorStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public enum ErrorStatus {
NOT_FOUND_LINE_STATION(HttpStatus.NOT_FOUND, 404, "지하철 노선도 역 리스트가 존재하지 않습니다."),
NOT_FOUND_ROUTE(HttpStatus.NOT_FOUND, 404, "존재하지 않는 경로입니다."),
NOT_FOUND_NOTI(HttpStatus.NOT_FOUND, 404, "존재하지 않는 알림입니다."),
NOT_FOUND_IN_RECENT_ROUTE_LIST(HttpStatus.NOT_FOUND, 404, "최근 경로 리스트 내 존재하지 않는 경로입니다."),


/**
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/makar/dev/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import makar.dev.common.exception.GeneralException;
import makar.dev.common.status.ErrorStatus;

import java.util.List;

Expand Down Expand Up @@ -89,7 +91,10 @@ public void addRecentRouteList(Route route) {
}
}
public void removeRecentRouteList(Route route) {
this.recentRouteList.remove(route);
boolean removed = this.recentRouteList.remove(route);
if (!removed) {
throw new GeneralException(ErrorStatus.NOT_FOUND_IN_RECENT_ROUTE_LIST);
}
}
public void clearRecentRouteList() {
this.recentRouteList.clear();
Expand Down

0 comments on commit 847cf14

Please sign in to comment.