Commit ff1172d8 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Changement des types d'exception

parent 62757e39
Loading
Loading
Loading
Loading
+3 −2
Changes for module/Import/src/Import/Service/Factory/FetcherServiceFactory.php: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ namespace Import\Service\Factory;
use Import\Service\FetcherService;
use Doctrine\ORM\EntityManager;
use Zend\ServiceManager\ServiceLocatorInterface as ContainerInterface;
use UnicaenApp\Exception;

class FetcherServiceFactory {

@@ -14,10 +15,10 @@ class FetcherServiceFactory {
        $config = $container->get('config');

        if (!isset($config['users']['login'])) {
            throw new \Exception("La clef <strong>login</strong> est manquante dans le fichier de configuration local de l'Import");
            throw new Exception\MandatoryValueException("La clef <strong>login</strong> est manquante dans le fichier de configuration local de l'Import");
        }
        if (!isset($config['users']['password'])) {
            throw new \Exception("La clef <strong>password</strong> est manquante dans le fichier de configuration local de l'Import");
            throw new Exception\MandatoryValueException("La clef <strong>password</strong> est manquante dans le fichier de configuration local de l'Import");
        }

        $service = new FetcherService($entityManager, $config);
+2 −5
Changes for module/Import/src/Import/Service/FetcherService.php: 2 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -4,12 +4,9 @@ namespace Import\Service;

use Doctrine\ORM\EntityManager;
use GuzzleHttp\Client;
use Import\Controller\Factory\ImportControllerFactory;
use Import\Controller\ImportController;
use Zend\Http\Response;
use DateTime;
use Zend\Mvc\Controller\Plugin\FlashMessenger;
use Zend\Mvc\Controller\Plugin\Redirect;
use UnicaenApp\Exception;

/**
 * FetcherService est un service dédié à la récupération des données provenant du Web Service fournit par chaque
@@ -127,7 +124,7 @@ class FetcherService
        }
        if ($position === -1) {
            print "<span style='background-color:salmon;'> L'établissement [" . $etablissement . "] n'a pas pu être trouvée.</span><br/>";
            throw new \Exception("L'établissement [" . $etablissement . "] n'a pas pu être trouvée.");
            throw new Exception\RuntimeException("L'établissement [" . $etablissement . "] n'a pas pu être trouvée.");
        }
        return $position;
    }