From 43f462c49d218e19d308e509dfc18840fb8b35ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Thu, 1 Sep 2022 16:55:15 +0200 Subject: [PATCH] Add log stmt to error from mark message as read --- .../sdk/scrapper/repository/MessagesRepository.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/MessagesRepository.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/MessagesRepository.kt index 6697337a..15b3f41a 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/MessagesRepository.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/MessagesRepository.kt @@ -12,10 +12,16 @@ import io.github.wulkanowy.sdk.scrapper.parseName import io.github.wulkanowy.sdk.scrapper.service.MessagesService import io.github.wulkanowy.sdk.scrapper.toMailbox import io.github.wulkanowy.sdk.scrapper.toRecipient +import org.slf4j.LoggerFactory import java.util.UUID class MessagesRepository(private val api: MessagesService) { + companion object { + @JvmStatic + private val logger = LoggerFactory.getLogger(this::class.java) + } + suspend fun getMailboxes(): List { return api.getMailboxes().map { it.toRecipient() @@ -81,6 +87,8 @@ class MessagesRepository(private val api: MessagesService) { appVersion = getScriptParam("version", startPage), body = mapOf("apiGlobalKey" to globalKey), ) + }.onFailure { + logger.error("Error occur while marking message as read", it) }.getOrNull() } return details