]> git.ipfire.org Git - thirdparty/python-drafthorse.git/commitdiff
Suppress output intent keyerror (#59)
authorEetu Purontaus <eetu.purontaus@gmail.com>
Wed, 22 Jan 2025 10:53:35 +0000 (12:53 +0200)
committerGitHub <noreply@github.com>
Wed, 22 Jan 2025 10:53:35 +0000 (11:53 +0100)
For non-compliant PDFs, output intent structure may be missing. Rather than logging an error, just debug and return.

Also use the correct logger.exception() instead of error so
the full exception gets logged.

drafthorse/pdf.py

index 3b07377747c1b8c98fc2ca096a5938d6c2025796..a17709a54d6d47cc3eef4de66278821209307378 100644 (file)
@@ -124,8 +124,10 @@ def _get_original_output_intents(original_pdf):
                 "/DestOutputProfile"
             ].get_object()
             output_intents.append((ori_output_intent_dict, dest_output_profile_dict))
+    except KeyError as ex:
+        logger.debug("Data missing from PDF: %s", ex)
     except Exception as ex:
-        logger.error(ex)
+        logger.exception(ex)
     return output_intents