[libcatmandu-perl] 62/85: Adding easier error message for Fix errors

Jonas Smedegaard dr at jones.dk
Tue May 20 09:56:20 UTC 2014


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

js pushed a commit to tag 0.91
in repository libcatmandu-perl.

commit 1ce02c893525f41e0d3dac1e0be90c4d5b8dfe84
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Sat May 17 17:47:22 2014 +0200

    Adding easier error message for Fix errors
---
 bin/catmandu        |  2 +-
 lib/Catmandu/CLI.pm | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bin/catmandu b/bin/catmandu
index ad57a1c..e66c888 100755
--- a/bin/catmandu
+++ b/bin/catmandu
@@ -5,7 +5,7 @@ use Catmandu::CLI;
 use Cwd ();
 
 Catmandu->default_load_path(Cwd::getcwd);
-Catmandu::CLI->run;
+Catmandu::CLI->run || exit 2;
 
 =head1 NAME
 
diff --git a/lib/Catmandu/CLI.pm b/lib/Catmandu/CLI.pm
index 6bcbec3..090378e 100644
--- a/lib/Catmandu/CLI.pm
+++ b/lib/Catmandu/CLI.pm
@@ -51,18 +51,26 @@ sub run {
     if ($@) {
         if ($@ =~ /^Can't locate Catmandu\/Importer/ && $ARGV[1] eq 'help') {
             print STDERR "You probably mean:\n\n\t$0 $ARGV[1] $ARGV[0]\n";
+            return undef;
         }
         elsif ($@ =~ /Can't locate Catmandu\/(Importer|Exporter|Store)\/([^\.]+)/) {
             print STDERR "Can't find:\n\n\tCatmandu::$1\::$2\n\nin your installation. Or a\n\n\t$2\n\nin your catmandu.yml\n";
+            return undef;
         }
         elsif ($@ =~ /unknown store default/) {
             print STDERR "You need to provide the type of a Store or define one in your catmandu.yml file.\n";
+            return undef;
+        }
+        elsif ($@ =~ /can't open "(.*)" for reading/) {
+            print STDERR "Can't find this Fix (file):\n\n\t$1\n\nDid you spell it correctly?\n";
+            return undef;
         }
         else {
             die $@;
         }
     }
-
+    
+    1;
 }
 
 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-perl.git



More information about the Pkg-perl-cvs-commits mailing list