From 5c06419f15a408ed50a732c6ac44d69148cf597d Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 11 May 2022 12:32:05 +0000 Subject: [PATCH] - Quick method to render an error view --- src/ControllerTrait.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ControllerTrait.php b/src/ControllerTrait.php index d47f216..9bb5e59 100644 --- a/src/ControllerTrait.php +++ b/src/ControllerTrait.php @@ -61,6 +61,13 @@ trait ControllerTrait { ); } + public function renderError(string $errorCode, ?array $variables = null) : ResponseInterface + { + return static::renderHtml( + $this->renderRawView("$lean/error/{$code}", $variables ?? []) + ); + } + public function renderDocumentation(string $filename) : ResponseInterface { return $this->renderMarkdown( file_get_contents(getenv("PROJECT_PATH") . "/meta/doc/$filename.md") );