Throw NotFoundError instead of InvalidArgumentException in RoleForm::remove()

This commit is contained in:
Eric Lippmann 2015-08-27 13:59:34 +02:00
parent 1135643fe1
commit 0681cd2782
1 changed files with 5 additions and 5 deletions

View File

@ -230,9 +230,9 @@ class RoleForm extends ConfigForm
*
* @return $this
*
* @throws LogicException If the config is not set
* @throws InvalidArgumentException If the role does not exist
* @see ConfigForm::setConfig() For setting the config.
* @throws LogicException If the config is not set
* @throws NotFoundError If the role does not exist
* @see ConfigForm::setConfig() For setting the config.
*/
public function remove($name)
{
@ -240,10 +240,10 @@ class RoleForm extends ConfigForm
throw new LogicException(sprintf('Can\'t remove role \'%s\'. Config is not set', $name));
}
if (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(sprintf(
throw new NotFoundError(
$this->translate('Can\'t remove role \'%s\'. Role does not exist'),
$name
));
);
}
$this->config->removeSection($name);
return $this;