Remove unnecessary try/catch from DB connection

This commit is contained in:
Alex Cabal 2024-04-27 12:37:09 -05:00
parent 07110829e7
commit fdca261133

View file

@ -19,7 +19,6 @@ class DbConnection{
$connectionString = 'mysql:';
try{
if(stripos($host, ':') !== false){
$port = null;
preg_match('/([^:]*):([0-9]+)/ius', $host, $matches);
@ -51,20 +50,6 @@ class DbConnection{
// We can't use persistent connections (connection pooling) because we would have race condition problems with last_insert_id()
$this->_link = new \PDO($connectionString, $user, $password, $params);
}
catch(Exception $ex){
if(SITE_STATUS == SITE_STATUS_DEV){
var_dump($ex);
}
else{
Log::WriteErrorLogEntry('Error connecting to ' . $connectionString . '. Exception: ' . vds($ex));
}
if($require){
print("Something crazy happened in our database.");
exit();
}
}
}
// Inputs: string $sql = the SQL query to execute
// array $params = an array of parameters to bind to the SQL statement