handle error on compile

This commit is contained in:
Andy Miller
2020-04-19 18:31:11 -06:00
parent 6a2abce7bf
commit e7e49607d4
2 changed files with 10 additions and 2 deletions

View File

@@ -290,7 +290,11 @@ class AdminPlugin extends Plugin
$obj = $event['object'];
if ($obj instanceof Data && $obj->blueprints()->getFilename() === 'admin/blueprints') {
$this->grav['admin-whitebox']->compileScss($obj);
[$status, $msg] = $this->grav['admin-whitebox']->compileScss($obj);
if (!$status) {
$this->grav['messages']->add($msg, 'error');
}
}
}

View File

@@ -32,7 +32,11 @@ class Whitebox
$preset_in_path = $admin_in_base .'/preset.scss';
$preset_out_path = $custom_out_base . '/'. $options['filename'] . '.css';
$this->compilePresetScss($color_scheme, $preset_in_path, $preset_out_path);
try {
$this->compilePresetScss($color_scheme, $preset_in_path, $preset_out_path);
} catch (\Exception $e) {
return [false, $e->getMessage()];
}
return [true, 'Recompiled successfully'];