From 6037b549591d82324ea194c568afd68befecf9ca Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Mon, 9 Nov 2020 00:04:39 +0100 Subject: [PATCH] Don't fail processing if generating preview fails --- .../docspell/joex/process/AttachmentPreview.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/joex/src/main/scala/docspell/joex/process/AttachmentPreview.scala b/modules/joex/src/main/scala/docspell/joex/process/AttachmentPreview.scala index 26db6b03..cbdf5de5 100644 --- a/modules/joex/src/main/scala/docspell/joex/process/AttachmentPreview.scala +++ b/modules/joex/src/main/scala/docspell/joex/process/AttachmentPreview.scala @@ -32,7 +32,16 @@ object AttachmentPreview { s"Creating preview images for ${item.attachments.size} files…" ) preview <- PdfboxPreview(24) - _ <- item.attachments.traverse(createPreview(ctx, preview, cfg.chunkSize)) + _ <- item.attachments + .traverse(createPreview(ctx, preview, cfg.chunkSize)) + .attempt + .flatMap { + case Right(_) => ().pure[F] + case Left(ex) => + ctx.logger.error(ex)( + s"Creating preview images failed, continuing without it." + ) + } } yield item }