mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-30 01:36:27 +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.
|
||||
$obj->slug($original_slug);
|
||||
|
||||
try {
|
||||
$obj->validate();
|
||||
} catch (\Exception $e) {
|
||||
$this->admin->setMessage($e->getMessage(), 'error');
|
||||
return false;
|
||||
}
|
||||
$obj->filter();
|
||||
|
||||
// rename folder based on visible
|
||||
@@ -1518,7 +1523,12 @@ class AdminController
|
||||
// Handle standard data types.
|
||||
$obj = $this->prepareData($data);
|
||||
$obj = $this->processFiles($obj);
|
||||
try {
|
||||
$obj->validate();
|
||||
} catch (\Exception $e) {
|
||||
$this->admin->setMessage($e->getMessage(), 'error');
|
||||
return false;
|
||||
}
|
||||
$obj->filter();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user