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

View File

@ -231,7 +231,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 does not exist * @throws NotFoundError If the role does not exist
* @see ConfigForm::setConfig() For setting the config. * @see ConfigForm::setConfig() For setting the config.
*/ */
public function remove($name) 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)); throw new LogicException(sprintf('Can\'t remove role \'%s\'. Config is not set', $name));
} }
if (! $this->config->hasSection($name)) { if (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(sprintf( throw new NotFoundError(
$this->translate('Can\'t remove role \'%s\'. Role does not exist'), $this->translate('Can\'t remove role \'%s\'. Role does not exist'),
$name $name
)); );
} }
$this->config->removeSection($name); $this->config->removeSection($name);
return $this; return $this;