Throw NotFoundError instead of InvalidArgumentException in RoleForm::update()
This commit is contained in:
parent
0681cd2782
commit
dad9f5ba7c
|
@ -259,7 +259,7 @@ class RoleForm extends ConfigForm
|
||||||
* @return $this
|
* @return $this
|
||||||
*
|
*
|
||||||
* @throws LogicException If the config is not set
|
* @throws LogicException If the config is not set
|
||||||
* @throws InvalidArgumentException If the role to update does not exist
|
* @throws NotFoundError If the role to update does not exist
|
||||||
* @see ConfigForm::setConfig() For setting the config.
|
* @see ConfigForm::setConfig() For setting the config.
|
||||||
*/
|
*/
|
||||||
public function update($name, array $values, $oldName)
|
public function update($name, array $values, $oldName)
|
||||||
|
@ -273,10 +273,10 @@ class RoleForm extends ConfigForm
|
||||||
$this->add($name, $values);
|
$this->add($name, $values);
|
||||||
} else {
|
} else {
|
||||||
if (! $this->config->hasSection($name)) {
|
if (! $this->config->hasSection($name)) {
|
||||||
throw new InvalidArgumentException(sprintf(
|
throw new NotFoundError(
|
||||||
$this->translate('Can\'t update role \'%s\'. Role does not exist'),
|
$this->translate('Can\'t update role \'%s\'. Role does not exist'),
|
||||||
$name
|
$name
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
$this->config->setSection($name, $values);
|
$this->config->setSection($name, $values);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue