Skip to content
Extraits de code Groupes Projets
Valider 3850551e rédigé par Matthieu Napoli's avatar Matthieu Napoli
Parcourir les fichiers

Fixes #7356 Do not catch and silence exceptions blindly

parent 42da3f87
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
namespace Piwik; namespace Piwik;
use Exception; use Exception;
use Piwik\Config\ConfigNotFoundException;
use Piwik\Ini\IniReader; use Piwik\Ini\IniReader;
use Piwik\Ini\IniReadingException; use Piwik\Ini\IniReadingException;
use Piwik\Ini\IniWriter; use Piwik\Ini\IniWriter;
...@@ -370,7 +371,7 @@ class Config extends Singleton ...@@ -370,7 +371,7 @@ class Config extends Singleton
public function checkLocalConfigFound() public function checkLocalConfigFound()
{ {
if (!$this->existsLocalConfig()) { if (!$this->existsLocalConfig()) {
throw new Exception(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathLocal))); throw new ConfigNotFoundException(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathLocal)));
} }
} }
......
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Config;
/**
* Exception thrown when the config file doesn't exist.
*/
class ConfigNotFoundException extends \Exception
{
}
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
namespace Piwik; namespace Piwik;
use Piwik\Config\ConfigNotFoundException;
use Piwik\Container\StaticContainer; use Piwik\Container\StaticContainer;
use Piwik\Plugin\Manager as PluginManager; use Piwik\Plugin\Manager as PluginManager;
use Symfony\Bridge\Monolog\Handler\ConsoleHandler; use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
...@@ -43,10 +44,9 @@ class Console extends Application ...@@ -43,10 +44,9 @@ class Console extends Application
try { try {
self::initPlugins(); self::initPlugins();
} catch(\Exception $e) { } catch (ConfigNotFoundException $e) {
// Piwik not installed yet, no config file? // Piwik not installed yet, no config file?
Log::warning($e->getMessage());
Log::debug("Could not initialize plugins: " . $e->getMessage() . "\n" . $e->getTraceAsString());
} }
$commands = $this->getAvailableCommands(); $commands = $this->getAvailableCommands();
......
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