From dd89e05cc2c79f3eb5c0e3e0934ed71e6e764cce Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Mon, 26 Oct 2020 19:48:29 +0100 Subject: [PATCH] Convert exceptions when converting to pdf into an error result The file processing tries pdf conversion once and keeps going if it fails. Some errors (e.g. timeouts) are raised via an exception. Issue: #387 --- .../main/scala/docspell/convert/extern/ExternConv.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/convert/src/main/scala/docspell/convert/extern/ExternConv.scala b/modules/convert/src/main/scala/docspell/convert/extern/ExternConv.scala index dcb02206..c0212f09 100644 --- a/modules/convert/src/main/scala/docspell/convert/extern/ExternConv.scala +++ b/modules/convert/src/main/scala/docspell/convert/extern/ExternConv.scala @@ -58,6 +58,13 @@ private[extern] object ExternConv { } .compile .lastOrError + .attempt + .flatMap { + case Right(v) => + v.pure[F] + case Left(ex) => + handler.run(ConversionResult.failure(ex)) + } def readResult[F[_]: Sync: ContextShift]( blocker: Blocker,