mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-30 09:56:11 +01:00
Better error messages for exceptions thrown in obj->validate() #594
This commit is contained in:
@@ -1495,7 +1495,12 @@ class AdminController
|
|||||||
// Reset slug and route. For now we do not support slug twig variable on save.
|
// Reset slug and route. For now we do not support slug twig variable on save.
|
||||||
$obj->slug($original_slug);
|
$obj->slug($original_slug);
|
||||||
|
|
||||||
|
try {
|
||||||
$obj->validate();
|
$obj->validate();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->admin->setMessage($e->getMessage(), 'error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$obj->filter();
|
$obj->filter();
|
||||||
|
|
||||||
// rename folder based on visible
|
// rename folder based on visible
|
||||||
@@ -1518,7 +1523,12 @@ class AdminController
|
|||||||
// Handle standard data types.
|
// Handle standard data types.
|
||||||
$obj = $this->prepareData($data);
|
$obj = $this->prepareData($data);
|
||||||
$obj = $this->processFiles($obj);
|
$obj = $this->processFiles($obj);
|
||||||
|
try {
|
||||||
$obj->validate();
|
$obj->validate();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->admin->setMessage($e->getMessage(), 'error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$obj->filter();
|
$obj->filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user