From 2f360de7cc0c7a944ade9ba7a886d6dfa0faa683 Mon Sep 17 00:00:00 2001 From: Aidas Klimas Date: Sat, 4 May 2024 13:27:15 +0300 Subject: [PATCH 1/2] add error reporting to block --- config/twill.php | 8 ++++++++ src/Services/Blocks/Block.php | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/config/twill.php b/config/twill.php index bebcbad00..a22eb5454 100644 --- a/config/twill.php +++ b/config/twill.php @@ -282,6 +282,14 @@ */ 'debug' => env('APP_DEBUG', false), + /* + |-------------------------------------------------------------------------- + | This parameter will throw errors if some error occurs instead of failing + | silently + |-------------------------------------------------------------------------- + */ + 'strict' => env('TWILL_STRICT', false), + /* |-------------------------------------------------------------------------- | Base classes for automatic generation of Modules and Capsules diff --git a/src/Services/Blocks/Block.php b/src/Services/Blocks/Block.php index 355117c89..de4ffd841 100644 --- a/src/Services/Blocks/Block.php +++ b/src/Services/Blocks/Block.php @@ -686,11 +686,15 @@ public function renderView( try { return view($view, $data)->render(); } catch (Exception $e) { + if (config('twill.strict')) { + throw $e; + } if (config('twill.debug')) { $error = $e->getMessage() . ' in ' . $e->getFile(); return View::make('twill::errors.block', ['view' => $view, 'error' => $error])->render(); } + report($e); } return ''; From d814f9999ba5319220e3d8b018807f9b7417b67a Mon Sep 17 00:00:00 2001 From: Quentin Renard Date: Fri, 24 May 2024 13:38:47 +0200 Subject: [PATCH 2/2] Update new configuration description --- config/twill.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/twill.php b/config/twill.php index a22eb5454..9b3d164ae 100644 --- a/config/twill.php +++ b/config/twill.php @@ -285,7 +285,7 @@ /* |-------------------------------------------------------------------------- | This parameter will throw errors if some error occurs instead of failing - | silently + | silently (eg. when rendering blocks) |-------------------------------------------------------------------------- */ 'strict' => env('TWILL_STRICT', false),