Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2015-03-10 23:41:04 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2015-03-10 23:41:04 +0300
commit3850551e56fe5881b9e1eb75dbd3cf4ea2907ca7 (patch)
tree2f7bea689c17d4bd13a0ed7bf9dc9f17dcb94ece /core
parent42da3f8768472598c33be76ddfcd72a6759d3dbc (diff)
Fixes #7356 Do not catch and silence exceptions blindly
Diffstat (limited to 'core')
-rw-r--r--core/Config.php3
-rw-r--r--core/Config/ConfigNotFoundException.php16
-rw-r--r--core/Console.php6
3 files changed, 21 insertions, 4 deletions
diff --git a/core/Config.php b/core/Config.php
index e28f581ea8..f0b5c3ed26 100644
--- a/core/Config.php
+++ b/core/Config.php
@@ -10,6 +10,7 @@
namespace Piwik;
use Exception;
+use Piwik\Config\ConfigNotFoundException;
use Piwik\Ini\IniReader;
use Piwik\Ini\IniReadingException;
use Piwik\Ini\IniWriter;
@@ -370,7 +371,7 @@ class Config extends Singleton
public function checkLocalConfigFound()
{
if (!$this->existsLocalConfig()) {
- throw new Exception(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathLocal)));
+ throw new ConfigNotFoundException(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathLocal)));
}
}
diff --git a/core/Config/ConfigNotFoundException.php b/core/Config/ConfigNotFoundException.php
new file mode 100644
index 0000000000..5860367ba7
--- /dev/null
+++ b/core/Config/ConfigNotFoundException.php
@@ -0,0 +1,16 @@
+<?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
+{
+}
diff --git a/core/Console.php b/core/Console.php
index 02e5f86871..fac27d8036 100644
--- a/core/Console.php
+++ b/core/Console.php
@@ -8,6 +8,7 @@
*/
namespace Piwik;
+use Piwik\Config\ConfigNotFoundException;
use Piwik\Container\StaticContainer;
use Piwik\Plugin\Manager as PluginManager;
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
@@ -43,10 +44,9 @@ class Console extends Application
try {
self::initPlugins();
- } catch(\Exception $e) {
+ } catch (ConfigNotFoundException $e) {
// Piwik not installed yet, no config file?
-
- Log::debug("Could not initialize plugins: " . $e->getMessage() . "\n" . $e->getTraceAsString());
+ Log::warning($e->getMessage());
}
$commands = $this->getAvailableCommands();