Add log stmt to error from mark message as read

This commit is contained in:
Mikołaj Pich 2022-09-01 16:55:15 +02:00
parent 0e00d4d2ac
commit 43f462c49d

View file

@ -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.service.MessagesService
import io.github.wulkanowy.sdk.scrapper.toMailbox import io.github.wulkanowy.sdk.scrapper.toMailbox
import io.github.wulkanowy.sdk.scrapper.toRecipient import io.github.wulkanowy.sdk.scrapper.toRecipient
import org.slf4j.LoggerFactory
import java.util.UUID import java.util.UUID
class MessagesRepository(private val api: MessagesService) { class MessagesRepository(private val api: MessagesService) {
companion object {
@JvmStatic
private val logger = LoggerFactory.getLogger(this::class.java)
}
suspend fun getMailboxes(): List<Mailbox> { suspend fun getMailboxes(): List<Mailbox> {
return api.getMailboxes().map { return api.getMailboxes().map {
it.toRecipient() it.toRecipient()
@ -81,6 +87,8 @@ class MessagesRepository(private val api: MessagesService) {
appVersion = getScriptParam("version", startPage), appVersion = getScriptParam("version", startPage),
body = mapOf("apiGlobalKey" to globalKey), body = mapOf("apiGlobalKey" to globalKey),
) )
}.onFailure {
logger.error("Error occur while marking message as read", it)
}.getOrNull() }.getOrNull()
} }
return details return details