From 9e46c1f20f01d297c6bc163ef0025431ef0d487e Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Mon, 27 Jun 2022 22:18:57 +0200 Subject: [PATCH] Add XML error to exception message --- PyPDF2/xmp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyPDF2/xmp.py b/PyPDF2/xmp.py index 6cd577863..3a15a3464 100644 --- a/PyPDF2/xmp.py +++ b/PyPDF2/xmp.py @@ -211,8 +211,8 @@ def __init__(self, stream: ContentStream) -> None: try: data = self.stream.get_data() doc_root: Document = parseString(data) - except ExpatError: - raise PdfReadError("XML in XmpInformation was invalid") + except ExpatError as e: + raise PdfReadError(f"XML in XmpInformation was invalid: {e}") self.rdf_root: XmlElement = doc_root.getElementsByTagNameNS( RDF_NAMESPACE, "RDF" )[0]