mirror of
https://github.com/restoreddev/phpapprentice.git
synced 2025-07-30 19:40:43 +02:00
Added exception throw when code file cannot be found
This commit is contained in:
@@ -96,6 +96,10 @@ class Build
|
||||
private function buildPage(Page $page): string
|
||||
{
|
||||
if (!empty($page->code)) {
|
||||
if (!file_exists(config('code_dir') . '/' . $page->code)) {
|
||||
throw new \Exception('Code file not found: ' . $page->code);
|
||||
}
|
||||
|
||||
$code = file_get_contents(config('code_dir') . '/' . $page->code);
|
||||
$page->variables['code'] = $code;
|
||||
}
|
||||
|
Reference in New Issue
Block a user