From 78fcc20190121d487a2e6cf1fca53b66df67dc3a Mon Sep 17 00:00:00 2001
From: Thomas Lange <code@nerdmind.de>
Date: Mon, 14 Jun 2021 20:03:19 +0200
Subject: Remove more redundant try/catch blocks

Remove all try/catch blocks where the exception handling did not differ
from the exception handler already defined by "set_exception_handler".
---
 core/include/page/main.php | 52 ++++++++++++++++------------------------------
 1 file changed, 18 insertions(+), 34 deletions(-)

(limited to 'core/include/page/main.php')

diff --git a/core/include/page/main.php b/core/include/page/main.php
index 6086345..955bb35 100644
--- a/core/include/page/main.php
+++ b/core/include/page/main.php
@@ -6,7 +6,7 @@ $Database = Application::getDatabase();
 $Language = Application::getLanguage();
 
 #===============================================================================
-# TRY: Page\Exception, User\Exception
+# TRY: Page\Exception
 #===============================================================================
 try {
 	if(Application::get('PAGE.SLUG_URLS')) {
@@ -36,36 +36,27 @@ try {
 	} catch(Page\Exception $Exception){}
 
 	#===============================================================================
-	# TRY: Template\Exception
+	# Build document
 	#===============================================================================
-	try {
-		$PageTemplate = Template\Factory::build('page/main');
-		$PageTemplate->set('PAGE', $page_data);
-		$PageTemplate->set('USER', $user_data);
-
-		$MainTemplate = Template\Factory::build('main');
-		$MainTemplate->set('HTML', $PageTemplate);
-		$MainTemplate->set('HEAD', [
-			'NAME' => $page_data['ATTR']['NAME'],
-			'DESC' => description($page_data['BODY']['HTML'](), Application::get('PAGE.DESCRIPTION_SIZE')),
-			'PERM' => $page_data['URL'],
-			'OG_IMAGES' => $page_data['FILE']['LIST']
-		]);
+	$PageTemplate = Template\Factory::build('page/main');
+	$PageTemplate->set('PAGE', $page_data);
+	$PageTemplate->set('USER', $user_data);
 
-		# Get access to the current item data from main template
-		$MainTemplate->set('TYPE', 'PAGE');
-		$MainTemplate->set('PAGE', $page_data);
-		$MainTemplate->set('USER', $user_data);
+	$MainTemplate = Template\Factory::build('main');
+	$MainTemplate->set('HTML', $PageTemplate);
+	$MainTemplate->set('HEAD', [
+		'NAME' => $page_data['ATTR']['NAME'],
+		'DESC' => description($page_data['BODY']['HTML'](), Application::get('PAGE.DESCRIPTION_SIZE')),
+		'PERM' => $page_data['URL'],
+		'OG_IMAGES' => $page_data['FILE']['LIST']
+	]);
 
-		echo $MainTemplate;
-	}
+	# Get access to the current item data from main template
+	$MainTemplate->set('TYPE', 'PAGE');
+	$MainTemplate->set('PAGE', $page_data);
+	$MainTemplate->set('USER', $user_data);
 
-	#===============================================================================
-	# CATCH: Template\Exception
-	#===============================================================================
-	catch(Template\Exception $Exception) {
-		Application::exit($Exception->getMessage());
-	}
+	echo $MainTemplate;
 }
 
 #===============================================================================
@@ -86,10 +77,3 @@ catch(Page\Exception $Exception) {
 		Application::error404();
 	}
 }
-
-#===============================================================================
-# CATCH: User\Exception
-#===============================================================================
-catch(User\Exception $Exception) {
-	Application::exit($Exception->getMessage());
-}
-- 
cgit v1.2.3