From b6aaf11ae2fe4c418f5a0ed6eca4060e726e9723 Mon Sep 17 00:00:00 2001 From: Mercier Pierre-Olivier Date: Sat, 14 Sep 2013 18:43:46 +0200 Subject: [PATCH] Warn only if project already exists --- hooks/subjects.pl | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/hooks/subjects.pl b/hooks/subjects.pl index 0ad91a5..19eb80d 100755 --- a/hooks/subjects.pl +++ b/hooks/subjects.pl @@ -171,11 +171,26 @@ sub tag_project } } + log INFO, "Information de l'intranet..."; # Call API - log ERROR, $_ if(API::Projects::add($project_id, $year)); + eval { + API::Projects::add($project_id, $year); + }; + if ($@) + { + if ($@ =~ /apP]roject [aA]ll?ready [eE]xists/) { + log WARN, $@; + } + else { + log ERROR, $@; + } + } # FIXME: Remove next line after 2016 piscine: ça ne devrait pas être fait à ce moment là - log ERROR, $_ if(API::Projects::gen_groups($project_id, $year)); + eval { + API::Projects::gen_groups($project_id, $year); + }; + log ERROR, $_ if($@); } else {