Skip to content
Extraits de code Groupes Projets
Valider 24b82931 rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

Sam::comands::ad handle errors

parent a1344b5c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -16,7 +16,10 @@ sub exec {
my $timestamp = timelocal(0, 59, 23, $day, $month - 1, $year);
my $chan = Sam::Chan->new(name => $chanName);
$chan->load();
unless ($chan->load(speculative => 1)) {
die "ce chan n'est pas encore configuré";
}
my $event = Sam::Event->new(
title => $title,
......
......@@ -66,9 +66,15 @@ sub exec {
$place =~ s/ $//;
my $id = Sam::commands::add::exec($chan->[0], $title, $day, $month, $year, $place, $desc);
if ($id) {
my $id;
eval {
$id = Sam::commands::add::exec($chan->[0], $title, $day, $month, $year, $place, $desc);
};
if ($@) {
$irc->yield(privmsg => $chan => "Erreur : $@");
}
elsif ($id) {
$lastID->{$chan->[0]} = $id;
$irc->yield(privmsg => $chan => "C'est enregistré. N'oubliez pas, conduire ou choisir, il faut boire !");
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter