Skip to content

Commit aa4803f

Browse files
committed
fix: handle unexpected exceptions as internal server error in tag validation
1 parent 0df3747 commit aa4803f

File tree

1 file changed

+6
-0
lines changed
  • noweekend-core/core-api/src/main/kotlin/noweekend/core/api/controller/v1/request

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema
44
import noweekend.core.domain.tag.BasicTag
55
import noweekend.core.support.error.CoreException
66
import noweekend.core.support.error.ErrorType
7+
import org.slf4j.LoggerFactory
78

89
@Schema(description = "자주하는 일정 DTO")
910
data class TagRequest(
@@ -13,6 +14,8 @@ data class TagRequest(
1314
)
1415
val scheduleTags: List<String>,
1516
) {
17+
private val log = LoggerFactory.getLogger(this::class.java)
18+
1619
fun validatedScheduleTags(): List<BasicTag> {
1720
val result = mutableListOf<BasicTag>()
1821
val invalid = mutableListOf<String>()
@@ -22,6 +25,9 @@ data class TagRequest(
2225
result.add(BasicTag.fromKorean(it.trim()))
2326
} catch (e: NoSuchElementException) {
2427
invalid.add(it)
28+
} catch (e: Exception) {
29+
log.error(e.printStackTrace().toString())
30+
throw CoreException(ErrorType.DEFAULT_ERROR)
2531
}
2632
}
2733
if (invalid.isNotEmpty()) throw CoreException(ErrorType.INVALID_SCHEDULE_TAG)

0 commit comments

Comments
 (0)