diff --git a/lib/Service/PicoService.php b/lib/Service/PicoService.php index a9f2090d..92ba8612 100644 --- a/lib/Service/PicoService.php +++ b/lib/Service/PicoService.php @@ -43,6 +43,7 @@ use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\ILogger; +use Twig\Error\Error; class PicoService { @@ -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) {