1
0
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:
Andrew Davis
2018-09-03 11:35:21 -05:00
parent f30f79c776
commit bf108af8e3

View File

@@ -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;
}