Log error when setting folder doesn't work

This commit is contained in:
eikek 2021-07-17 14:52:46 +02:00
parent d06d541d0a
commit 1c0d87527b

View File

@ -12,6 +12,7 @@ import cats.implicits._
import docspell.backend.ops.OItem import docspell.backend.ops.OItem
import docspell.common._ import docspell.common._
import docspell.joex.scheduler.Task import docspell.joex.scheduler.Task
import docspell.store.UpdateResult
object SetGivenData { object SetGivenData {
type Args = ProcessItemArgs type Args = ProcessItemArgs
@ -46,7 +47,12 @@ object SetGivenData {
e <- ops.setFolder(itemId, folderId, collective).attempt e <- ops.setFolder(itemId, folderId, collective).attempt
_ <- e.fold( _ <- e.fold(
ex => ctx.logger.warn(s"Error setting folder: ${ex.getMessage}"), ex => ctx.logger.warn(s"Error setting folder: ${ex.getMessage}"),
_ => ().pure[F] res =>
res match {
case UpdateResult.Failure(ex) =>
ctx.logger.warn(s"Error setting folder: ${ex.getMessage}")
case _ => ().pure[F]
}
) )
} yield data } yield data
} }