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

[lintian] 01/02: L::Command: Use croak rather than (L::Util::)fail



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 86681a9f70586d9951547892262c5b67b5e5c928
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Nov 2 14:24:02 2014 +0100

    L::Command: Use croak rather than (L::Util::)fail
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog       |  8 ++++++++
 lib/Lintian/Command.pm | 24 ++++++++++--------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e9b3a81..c8f98a5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+lintian (2.5.31) UNRELEASED; urgency=medium
+
+  * lib/Lintian/Command.pm:
+    + [NT] Use croak() rather than L::Util's fail() on errors.
+      The issues are generally not "internal errors".
+
+ -- Niels Thykier <niels@thykier.net>  Sun, 02 Nov 2014 14:22:59 +0100
+
 lintian (2.5.30) unstable; urgency=medium
 
   The "welcome Axel Beckert!" release.
diff --git a/lib/Lintian/Command.pm b/lib/Lintian/Command.pm
index affc61e..43a5be0 100644
--- a/lib/Lintian/Command.pm
+++ b/lib/Lintian/Command.pm
@@ -20,6 +20,8 @@ package Lintian::Command;
 use strict;
 use warnings;
 
+use Carp qw(croak);
+
 BEGIN {
     # Disabling IPC::Run::Debug saves tons of useless calls.
     $ENV{'IPCRUNDEBUG'} = 'none'
@@ -273,21 +275,19 @@ sub spawn {
         }
     };
     if ($@) {
-        require Lintian::Util;
-        Lintian::Util::fail($@) if $opts->{fail} ne 'never';
+        croak($@) if $opts->{fail} ne 'never';
         $opts->{success} = 0;
         $opts->{exception} = $@;
     } elsif ($opts->{fail} eq 'error'
         and not $opts->{success}) {
-        require Lintian::Util;
         if ($opts->{description}) {
-            Lintian::Util::fail("$opts->{description} failed with error code "
+            croak("$opts->{description} failed with error code "
                   . $opts->{harness}->result);
         } elsif (@cmds == 1) {
-            Lintian::Util::fail("$cmds[0][0] failed with error code "
+            croak("$cmds[0][0] failed with error code "
                   . $opts->{harness}->result);
         } else {
-            Lintian::Util::fail(
+            croak(
                 'command failed with error code ' . $opts->{harness}->result);
         }
     }
@@ -331,19 +331,16 @@ sub reap {
 
         eval {$opts->{success} = $opts->{harness}->finish;};
         if ($@) {
-            require Lintian::Util;
-            Lintian::Util::fail($@) if $opts->{fail} ne 'never';
+            croak($@) if $opts->{fail} ne 'never';
             $opts->{success} = 0;
             $opts->{exception} = $@;
         } elsif ($opts->{fail} eq 'error'
             and not $opts->{success}) {
-            require Lintian::Util;
             if ($opts->{description}) {
-                Lintian::Util::fail(
-                    "$opts->{description} failed with error code "
+                croak("$opts->{description} failed with error code "
                       . $opts->{harness}->result);
             } else {
-                Lintian::Util::fail('command failed with error code '
+                croak('command failed with error code '
                       . $opts->{harness}->result);
             }
         }
@@ -388,8 +385,7 @@ sub done {
     if ($@ =~ m/process ended prematurely/) {
         return 1;
     } else {
-        require Lintian::Util;
-        Lintian::Util::fail("Unknown failure when trying to pump_nb: $@");
+        croak("Unknown failure when trying to pump_nb: $@");
     }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: