Skip to content

Commit c1f2b05

Browse files
AidasKAidas Klimas
authored andcommitted
add error reporting to block
1 parent 8611299 commit c1f2b05

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

config/twill.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@
282282
*/
283283
'debug' => env('APP_DEBUG', false),
284284

285+
/*
286+
|--------------------------------------------------------------------------
287+
| This parameter will throw errors if some error occurs instead of failing
288+
| silently
289+
|--------------------------------------------------------------------------
290+
*/
291+
'strict' => env('TWILL_STRICT', false),
292+
285293
/*
286294
|--------------------------------------------------------------------------
287295
| Base classes for automatic generation of Modules and Capsules

src/Services/Blocks/Block.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,11 +686,15 @@ public function renderView(
686686
try {
687687
return view($view, $data)->render();
688688
} catch (Exception $e) {
689+
if (config('twill.strict')) {
690+
throw $e;
691+
}
689692
if (config('twill.debug')) {
690693
$error = $e->getMessage() . ' in ' . $e->getFile();
691694

692695
return View::make('twill::errors.block', ['view' => $view, 'error' => $error])->render();
693696
}
697+
report($e);
694698
}
695699

696700
return '';

0 commit comments

Comments
 (0)