From d453ba414803832bb4e4f9ae5eddec7ae3f60205 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 14 Jun 2021 19:06:04 +0200 Subject: Remove redundant try/catch block Remove the redundant exception handler from core/application.php. The exception handling in the catch block did not differ from the default handler already defined by "set_exception_handler". --- core/application.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/core/application.php b/core/application.php index 3c431f8..38025b8 100644 --- a/core/application.php +++ b/core/application.php @@ -141,22 +141,23 @@ if(defined('ADMINISTRATION') AND ADMINISTRATION === TRUE) { require 'functions.php'; #=============================================================================== -# TRY: PDOException +# Get Language and Database singletons #=============================================================================== -try { - $Language = Application::getLanguage(); - $Database = Application::getDatabase(); - - $Database->setAttribute($Database::ATTR_DEFAULT_FETCH_MODE, $Database::FETCH_ASSOC); - $Database->setAttribute($Database::ATTR_ERRMODE, $Database::ERRMODE_EXCEPTION); -} +$Language = Application::getLanguage(); +$Database = Application::getDatabase(); #=============================================================================== -# CATCH: PDOException +# Set Database attributes #=============================================================================== -catch(PDOException $Exception) { - Application::exit($Exception->getMessage()); -} +$Database->setAttribute( + $Database::ATTR_DEFAULT_FETCH_MODE, + $Database::FETCH_ASSOC +); + +$Database->setAttribute( + $Database::ATTR_ERRMODE, + $Database::ERRMODE_EXCEPTION +); #=============================================================================== # Check if "304 Not Modified" and ETag header should be sent -- cgit v1.2.3