From f3d75b3ae5ba6f375a04b46e4f72a210cafe9d54 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 25 Dec 2019 23:21:12 +0100 Subject: tec: Improve logs on DB connection failure (#2734) For a moment, PHP wasn't able to connect to my database. I tried to understand what happened, unfortunately, the logs were not very helpful (it basically showed me information that I had in my configuration file). I changed the dsn string by the message from the raised exception, I think it will be more useful. Other call of Minz_PDOConnectionException are passing error messages instead of string connection, so I took the opportunity to rename the constructor argument. --- lib/Minz/ModelPdo.php | 2 +- lib/Minz/PDOConnectionException.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index ed88d58d1..65ac5653b 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -91,7 +91,7 @@ class Minz_ModelPdo { self::$sharedPdo = $this->pdo; } catch (Exception $e) { throw new Minz_PDOConnectionException( - $dsn . $dsnParams, + $e->getMessage(), $db['user'], Minz_Exception::ERROR ); } diff --git a/lib/Minz/PDOConnectionException.php b/lib/Minz/PDOConnectionException.php index 064748708..11e4d1029 100644 --- a/lib/Minz/PDOConnectionException.php +++ b/lib/Minz/PDOConnectionException.php @@ -1,8 +1,7 @@