Skip to content

Commit 97b4742

Browse files
committed
fix: 코스 경로 좌표 누락 예외 처리 추가
1 parent 094c4dc commit 97b4742

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/main/java/com/semosan/api/common/status/ErrorStatus.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public enum ErrorStatus implements BaseStatus {
114114
TRACKING_SESSION_INVALID_STATE(HttpStatus.CONFLICT, "TRK_409_2", "현재 상태에서는 수행할 수 없는 작업입니다."),
115115
TRACKING_COURSE_MOUNTAIN_MISMATCH(HttpStatus.BAD_REQUEST, "TRK_400_1", "선택한 코스가 해당 산의 코스가 아닙니다."),
116116
TRACKING_COURSE_ID_REQUIRED(HttpStatus.BAD_REQUEST, "TRK_400_2", "자유 기록이 아니면 코스 ID는 필수입니다."),
117+
TRACKING_COURSE_POLYLINE_REQUIRED(HttpStatus.UNPROCESSABLE_ENTITY, "TRK_422_1", "코스 경로 좌표가 등록되지 않았습니다."),
117118
COURSE_NOT_FOUND(HttpStatus.NOT_FOUND, "MTN_404_3", "코스를 찾을 수 없습니다."),
118119

119120
/**

src/main/java/com/semosan/api/domain/tracking/dto/response/LiveActivityCourseResponse.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.semosan.api.domain.tracking.dto.response;
22

3+
import com.semosan.api.common.exception.GeneralException;
4+
import com.semosan.api.common.status.ErrorStatus;
35
import com.semosan.api.domain.mountain.entity.Course;
46
import org.locationtech.jts.geom.Coordinate;
57
import org.locationtech.jts.geom.LineString;
@@ -24,8 +26,8 @@ public static LiveActivityCourseResponse from(Course course) {
2426
}
2527

2628
private static List<CoordinateInfo> toCoordinates(LineString polyline) {
27-
if (polyline == null) {
28-
return List.of();
29+
if (polyline == null || polyline.isEmpty()) {
30+
throw new GeneralException(ErrorStatus.TRACKING_COURSE_POLYLINE_REQUIRED);
2931
}
3032
return Arrays.stream(polyline.getCoordinates())
3133
.map(CoordinateInfo::from)

0 commit comments

Comments
 (0)