diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt index 7e1ff9d2..fd516349 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/infrastructure/exposedquery/NoteQueryServiceImpl.kt @@ -14,6 +14,7 @@ import dev.usbharu.hideout.util.singleOr import org.jetbrains.exposed.sql.Query import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.select +import org.slf4j.LoggerFactory import org.springframework.stereotype.Repository import java.time.Instant @@ -47,7 +48,12 @@ class NoteQueryServiceImpl(private val postRepository: PostRepository, private v private suspend fun ResultRow.toNote(mediaList: List): Note { val replyId = this[Posts.replyId] val replyTo = if (replyId != null) { - postRepository.findById(replyId).url + try { + postRepository.findById(replyId).url + } catch (e: FailedToGetResourcesException) { + logger.warn("Failed to get replyId: $replyId", e) + null + } } else { null } @@ -86,4 +92,8 @@ class NoteQueryServiceImpl(private val postRepository: PostRepository, private v Visibility.DIRECT -> TODO() } } + + companion object { + private val logger = LoggerFactory.getLogger(NoteQueryServiceImpl::class.java) + } }