Skip to content

Commit

Permalink
Handle PDOException when reading template from database
Browse files Browse the repository at this point in the history
  • Loading branch information
budziam committed Oct 4, 2021
1 parent f5b25e0 commit d671b89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion includes/Theme/TemplateContentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use App\Support\FileSystemContract;
use App\System\Settings;
use PDOException;

class TemplateContentService
{
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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
{
Expand Down

0 comments on commit d671b89

Please sign in to comment.