From d3648e0913cee2bbceb2699693d62a71215b4f1b Mon Sep 17 00:00:00 2001 From: Blaine Motsinger Date: Sat, 6 Jul 2024 18:19:42 -0400 Subject: [PATCH] Add errstr to parse error output This commit appends the errstr to the parse error output after the get calls if it exists. --- lib/XML/Feed.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/XML/Feed.pm b/lib/XML/Feed.pm index 307df52..815ef2a 100644 --- a/lib/XML/Feed.pm +++ b/lib/XML/Feed.pm @@ -48,7 +48,11 @@ sub parse { } else { $xml = $class->get_file($stream); } - return $class->error("Can't get feed XML content from $stream") + my $errstr = "Can't get feed XML content from $stream"; + if ($class->errstr) { + $errstr .= ": " . $class->errstr; + } + return $class->error($errstr) unless $xml; my $format; if ($specified_format) {