fix: ResourceAccessExceptionをSQLExceptionにして再throwするように

This commit is contained in:
usbharu 2023-12-22 16:13:39 +09:00
parent 9c5aaedf4d
commit fff1296d4c
1 changed files with 7 additions and 1 deletions

View File

@ -5,8 +5,10 @@ import dev.usbharu.hideout.activitypub.domain.exception.FailedProcessException
import dev.usbharu.hideout.activitypub.domain.exception.HttpSignatureUnauthorizedException
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
import dev.usbharu.hideout.application.external.Transaction
import dev.usbharu.hideout.core.domain.exception.resource.ResourceAccessException
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.sql.SQLException
abstract class AbstractActivityPubProcessor<T : Object>(
private val transaction: Transaction,
@ -21,7 +23,11 @@ abstract class AbstractActivityPubProcessor<T : Object>(
logger.info("START ActivityPub process. {}", this.type())
try {
transaction.transaction {
internalProcess(activity)
try {
internalProcess(activity)
} catch (e: ResourceAccessException) {
throw SQLException(e)
}
}
} catch (e: ActivityPubProcessException) {
logger.warn("FAILED ActivityPub process", e)