[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 1/1] Don't obscure errors with custom errors only



When coming out of eval blocks and reporting on errors, make sure $@ is
included as part of the textual output so that the real underlying error is
reported.
---
 I was recently bitten by this:

 dpkg-source: error: source package format `3.0 (native)' is not supported
 (Perl module Dpkg::Source::Package::V3::native is required)

 Of course, that file is being required just fine, the problem turned out
 to be missing File::Temp, but without including $@, I would never have
 know this, due to a custom error message completely hiding this detail.

 scripts/Dpkg/Source/Package.pm |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 693eda5..92905ea 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -233,7 +233,8 @@ sub upgrade_object_type {
             $self->{'fields'}{'Format'} .= " ($variant)" if defined $variant;
         }
         if ($@) {
-	    error(_g("source package format `%s' is not supported (Perl module %s is required)"), $format, $module);
+	    error(_g("source package format `%s' is not supported (Perl module %s is required): %s"),
+			$format, $module, $@);
         }
         bless $self, $module;
     } else {
-- 
1.7.9.1


Reply to: