From 35761adf6445f5174991d9b21799c0282a3a22cb Mon Sep 17 00:00:00 2001 From: InusualZ Date: Sun, 13 Jun 2021 14:44:26 -0400 Subject: [PATCH] DirectObjectFinder: Throwing exception print the token name that we got --- src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs b/src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs index eb085a47..39b88528 100644 --- a/src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs +++ b/src/UglyToad.PdfPig/Parser/Parts/DirectObjectFinder.cs @@ -76,7 +76,7 @@ } } - throw new PdfDocumentFormatException($"Could not find the object number {reference} with type {typeof(T).Name}."); + throw new PdfDocumentFormatException($"Could not find the object number {reference} with type {typeof(T).Name} instead, it was found with type {temp.GetType().Name}."); } public static T Get(IToken token, IPdfTokenScanner scanner) where T : class, IToken @@ -91,7 +91,7 @@ return Get(reference.Data, scanner); } - throw new PdfDocumentFormatException($"Could not find the object {token} with type {typeof(T).Name}."); + throw new PdfDocumentFormatException($"Could not find the object {token} with type {typeof(T).Name} instead, it was found with type {token.GetType().Name}."); } } }