Browse Source

Fix issue #157: message lors d'un PDOConnectionException

Le message est loggué dans le fichier qui va bien et un message est affiché
à l'écran : ### Application problem ### See logs files
Marien Fressinaud 12 years ago
parent
commit
9fcca8a782
3 changed files with 10 additions and 5 deletions
  1. 1 1
      lib/minz/FrontController.php
  2. 1 1
      lib/minz/dao/Model_pdo.php
  3. 8 3
      public/index.php

+ 1 - 1
lib/minz/FrontController.php

@@ -118,6 +118,6 @@ class FrontController {
 		if ($txt == '') {
 			$txt = 'See logs files';
 		}
-		exit ('### Application problem ###'."\n".$txt);
+		exit ('### Application problem ###'."\n".$txt);
 	}
 }

+ 1 - 1
lib/minz/dao/Model_pdo.php

@@ -33,7 +33,7 @@ class Model_pdo {
 				        . ';charset=utf8';
 				$driver_options = array(
 					PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
-					);
+				);
 			} elseif($type == 'sqlite') {
 				$string = $type
 				        . ':/' . PUBLIC_PATH

+ 8 - 3
public/index.php

@@ -38,7 +38,12 @@ if (file_exists (PUBLIC_PATH . '/install.php')) {
 
 	require (APP_PATH . '/App_FrontController.php');
 
-	$front_controller = new App_FrontController ();
-	$front_controller->init ();
-	$front_controller->run ();
+	try {
+		$front_controller = new App_FrontController ();
+		$front_controller->init ();
+		$front_controller->run ();
+	} catch (PDOConnectionException $e) {
+		Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
+		print '### Application problem ###'."\n".'See logs files';
+	}
 }