From 31d61435ddacc8c47b2dc80ef046ff8f1fd7c7bd Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:03:38 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E3=83=AA=E3=83=97=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E5=85=88=E5=8F=96=E5=BE=97=E5=A4=B1=E6=95=97=E6=99=82=E3=81=AE?= =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=8F=E3=83=B3=E3=83=89=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exposedquery/NoteQueryServiceImpl.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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) + } }