From d671b89b33c7e87379587e73f344ee1c61ff47a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Budziak?= Date: Mon, 4 Oct 2021 20:16:06 +0200 Subject: [PATCH] Handle PDOException when reading template from database --- includes/Theme/TemplateContentService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/Theme/TemplateContentService.php b/includes/Theme/TemplateContentService.php index eda8ba743..d3540e51b 100644 --- a/includes/Theme/TemplateContentService.php +++ b/includes/Theme/TemplateContentService.php @@ -3,6 +3,7 @@ use App\Support\FileSystemContract; use App\System\Settings; +use PDOException; class TemplateContentService { @@ -79,7 +80,7 @@ private function read($name, $theme, $lang): string { try { return $this->readFromDB($name, $theme, $lang); - } catch (TemplateNotFoundException $e) { + } catch (TemplateNotFoundException | PDOException $e) { return $this->readFromFile($theme ?: TemplateRepository::DEFAULT_THEME, $name, $lang); } } @@ -90,6 +91,7 @@ private function read($name, $theme, $lang): string * @param string|null $lang * @return string * @throws TemplateNotFoundException + * @throws PDOException */ private function readFromDB($name, $theme, $lang): string {