Skip to content

Commit

Permalink
improve twig error logging
Browse files Browse the repository at this point in the history
Signed-off-by: derMart <[email protected]>
  • Loading branch information
derMart committed Dec 23, 2022
1 parent cf9edc1 commit 13b56e6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Service/PicoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\ILogger;
use Twig\Error\Error;

class PicoService
{
Expand Down Expand Up @@ -147,6 +148,16 @@ public function getPage(WebsiteRequest $websiteRequest): PicoPage
$this->loadPicoPlugins($pico);

$output = $pico->run();
} catch (Error $e) {
$this->logger->error(
'Twig Error',
[ 'error' => $e->getMessage(),
'file' => $e->getFile(),
'line_number' => $e->getTemplateLine()
]
);
$exception = new PicoRuntimeException($e);
throw $exception;
} catch (WebsiteInvalidFilesystemException $e) {
throw $e;
} catch (InvalidPathException | NotFoundException | NotPermittedException $e) {
Expand Down

0 comments on commit 13b56e6

Please sign in to comment.