Browse Source

gestion d'erreur si cocktail mal configuré dans config.yml

Sniperovitch 8 years ago
parent
commit
212aee3e5f
1 changed files with 8 additions and 2 deletions
  1. 8 2
      lib/Bartender.pm

+ 8 - 2
lib/Bartender.pm

@@ -13,8 +13,14 @@ get '/shake' => sub {
     my $opt_garde  = $param{projetPadGarde};
     my $opt_projet = $param{projetId};
     my $cocktail = config->{cocktail}{binary};
-    die unless -x $cocktail;
-
+    if(not defined $cocktail) {
+        warn "cocktail:binary n'est pas configuré dans config.yml";
+        return;
+    }
+    elsif(not -x $cocktail) {
+        warn "cocktail$cocktail n'est pas executable";
+        return;
+    }
     system("$cocktail -d $opt_dossier -b '$opt_base' -g '$opt_garde' -p $opt_projet &");
     redirect request->referer;
 };