Skip to content

Commit 9196154

Browse files
committed
fix: handle invalid schedule tags with custom error response
1 parent 3b60368 commit 9196154

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

noweekend-core/core-api/src/main/kotlin/noweekend/core/api/controller/v1/request/TagRequest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package noweekend.core.api.controller.v1.request
22

33
import io.swagger.v3.oas.annotations.media.Schema
44
import noweekend.core.domain.tag.BasicTag
5+
import noweekend.core.support.error.CoreException
6+
import noweekend.core.support.error.ErrorType
57

68
@Schema(description = "자주하는 일정 DTO")
79
data class TagRequest(
@@ -22,7 +24,7 @@ data class TagRequest(
2224
invalid.add(it)
2325
}
2426
}
25-
if (invalid.isNotEmpty()) throw IllegalArgumentException("유효하지 않은 태그입니다: $invalid")
27+
if (invalid.isNotEmpty()) throw CoreException(ErrorType.INVALID_SCHEDULE_TAG)
2628
return result
2729
}
2830
}

noweekend-core/core-api/src/main/kotlin/noweekend/core/support/error/ErrorType.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ enum class ErrorType(
2424
USER_BIRTH_DAY_NOT_FOUND(HttpStatus.BAD_REQUEST, ErrorCode.E400, "사용자가 생일을 갖고있지 않습니다. 생일 먼저 추가해주세요.", LogLevel.WARN),
2525
MCP_SERVER_SANDWICH_ERROR(HttpStatus.GATEWAY_TIMEOUT, ErrorCode.E504, "MCP 추천 서버의 응답이 없습니다. 잠시 후 다시 시도해주세요.", LogLevel.ERROR),
2626
INVALID_LOCATION(HttpStatus.BAD_REQUEST, ErrorCode.E400, "사용자가 한국 위치가 아니기 때문에 날씨를 추천할 수 없습니다.", LogLevel.WARN),
27+
INVALID_SCHEDULE_TAG(HttpStatus.BAD_REQUEST, ErrorCode.E400, "유효하지 않은 태그가 포함되어 있습니다.", LogLevel.WARN),
2728
}

0 commit comments

Comments
 (0)