mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-17 22:28:46 +01:00
[task/refactor-db-testcase] Improve error message of db tests
If database tests cannot be run the error message is ambigous. This commit makes it clearer: - whether the supplied dbms is supported by us - which dbms are supported by us - whether the required PDO extension is loaded PHPBB3-10043
This commit is contained in:
parent
6c7f49f561
commit
17b17bc939
@ -76,7 +76,14 @@ class phpbb_database_test_connection_manager
|
||||
break;
|
||||
}
|
||||
|
||||
$this->pdo = new PDO($dsn, $this->config['dbuser'], $this->config['dbpasswd']);;
|
||||
try
|
||||
{
|
||||
$this->pdo = new PDO($dsn, $this->config['dbuser'], $this->config['dbpasswd']);
|
||||
}
|
||||
catch (PDOException $e)
|
||||
{
|
||||
throw new Exception("Unable do connect to $dsn with error: {$e->getMessage()}");
|
||||
}
|
||||
|
||||
// good for debug
|
||||
// $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
@ -330,7 +337,9 @@ class phpbb_database_test_connection_manager
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('Database unsupported', E_USER_ERROR);
|
||||
$message = 'Supplied dbms is unsupported, must be one of: ';
|
||||
$message .= implode(', ', array_keys($available_dbms));
|
||||
throw new Exception($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user