Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import org.withtime.be.withtimebe.global.error.code.WeatherErrorCode;
import org.withtime.be.withtimebe.global.error.exception.WeatherException;

import java.time.LocalDate;

Expand All @@ -26,8 +28,7 @@ public static GetWeeklyRecommendation of(Long regionId, LocalDate startDate) {
LocalDate maxDate = now.plusDays(7);

if (startDate.isBefore(minDate) || startDate.isAfter(maxDate)) {
throw new IllegalArgumentException(
"쑰회 κ°€λŠ₯ν•œ μ‹œμž‘ λ‚ μ§œ λ²”μœ„λ₯Ό λ²—μ–΄λ‚¬μŠ΅λ‹ˆλ‹€. (7일 μ „ ~ 7일 ν›„)");
throw new WeatherException(WeatherErrorCode.INVALID_DATE_RANGE);
}
}

Expand Down Expand Up @@ -57,8 +58,7 @@ public static GetWeeklyPrecipitation of(Long regionId, LocalDate startDate) {
LocalDate maxDate = now.plusDays(10);

if (startDate.isBefore(minDate) || startDate.isAfter(maxDate)) {
throw new IllegalArgumentException(
"쑰회 κ°€λŠ₯ν•œ μ‹œμž‘ λ‚ μ§œ λ²”μœ„λ₯Ό λ²—μ–΄λ‚¬μŠ΅λ‹ˆλ‹€. (7일 μ „ ~ 10일 ν›„)");
throw new WeatherException(WeatherErrorCode.INVALID_DATE_RANGE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.withtime.be.withtimebe.domain.weather.data.utils.WeatherDataHelper;
import org.withtime.be.withtimebe.domain.weather.dto.request.WeatherSyncReqDTO;
import org.withtime.be.withtimebe.domain.weather.dto.response.WeatherSyncResDTO;
import org.withtime.be.withtimebe.global.error.code.WeatherErrorCode;
import org.withtime.be.withtimebe.global.error.exception.WeatherException;

import java.time.LocalDate;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -109,7 +111,7 @@ private Object executeJob(WeatherSyncReqDTO.ManualTrigger request) {
.build();
}

default -> throw new IllegalArgumentException("μ§€μ›ν•˜μ§€ μ•ŠλŠ” μž‘μ—… νƒ€μž…: " + request.jobType());
default -> throw new WeatherException(WeatherErrorCode.UNSUPPORTED_TASK_TYPE);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ public enum WeatherErrorCode implements BaseErrorCode {
REGION_ALREADY_EXISTS(HttpStatus.BAD_REQUEST, "WEATHER400_0", "이미 μ‘΄μž¬ν•˜λŠ” μ§€μ—­μž…λ‹ˆλ‹€."),
WEATHER_TEMPLATE_ALREADY_EXISTS(HttpStatus.BAD_REQUEST, "WEATHER400_1", "이미 μ‘΄μž¬ν•˜λŠ” 날씨 ν…œν”Œλ¦Ώμž…λ‹ˆλ‹€."),
INVALID_COORDINATES(HttpStatus.BAD_REQUEST, "WEATHER400_2", "μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ μ’Œν‘œμž…λ‹ˆλ‹€."),
INVALID_DATE_RANGE(HttpStatus.BAD_REQUEST, "WEATHER400_3", "μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ λ‚ μ§œ λ²”μœ„μž…λ‹ˆλ‹€."),
INVALID_DATE_RANGE(HttpStatus.BAD_REQUEST, "WEATHER400_3", "μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ λ‚ μ§œ λ²”μœ„μž…λ‹ˆλ‹€. 쑰회 κ°€λŠ₯ν•œ μ‹œμž‘ λ‚ μ§œ λ²”μœ„λ₯Ό λ²—μ–΄λ‚¬μŠ΅λ‹ˆλ‹€. (7일 μ „ ~ 7일 ν›„)"),
INVALID_WEATHER_DATA(HttpStatus.BAD_REQUEST, "WEATHER400_4", "μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ 날씨 λ°μ΄ν„°μž…λ‹ˆλ‹€."),
INVALID_REGION_CODE(HttpStatus.BAD_REQUEST, "WEATHER400_5", "μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ μ§€μ—­μ½”λ“œμž…λ‹ˆλ‹€."),
INVALID_ENUM_VALUE(HttpStatus.BAD_REQUEST, "WEATHER400_6", "μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ μ—΄κ±°ν˜• κ°’μž…λ‹ˆλ‹€."),
UNSUPPORTED_TASK_TYPE(HttpStatus.BAD_REQUEST, "WEATHER400_7", "μ§€μ›ν•˜μ§€ μ•ŠλŠ” μž‘μ—… νƒ€μž…μž…λ‹ˆλ‹€."),

// ==== κΆŒν•œ/인증 μ—λŸ¬ (403) ====
ACCESS_DENIED(HttpStatus.FORBIDDEN, "WEATHER403_0", "μ ‘κ·Ό κΆŒν•œμ΄ μ—†μŠ΅λ‹ˆλ‹€."),
Expand Down