Gestion des codes retour d'un scenario (succès/erreur)

Hello
Tu peux faire un try catch et t’envoyer une notification … c’est ce que je fais personnellement … :slight_smile:

public static function executeCommande($commandName,$scenario=NULL) {
          self::log($scenario,"executeCommande | $commandName");
          try {
            $cmd=cmd::byString('#'.$commandName.'#');
            return $cmd->execCmd();
          } catch (Exception $e) {
            self::manageError($scenario,$e);
          }
    }

public static function manageError($scenario=null,$e) {
        self::log($scenario,"		* Erreur execution commande : " . $e->getMessage());
        $message=self::getScenarioName($scenario) . ' - erreur : ' . $e->getMessage();
      	self::log($scenario,$message);
        notificationFunction::sendJeedomConnectMessage($scenario,self::exceptionReceiver,'Notification','','Erreur scenario : ',$message);
        throw $e;
    }
  
3 « J'aime »