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

This commit is contained in:
Eric Lippmann 2015-08-27 13:57:10 +02:00
parent c5d0094e8e
commit 13131cb3f6
1 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@
namespace Icinga\Forms\Security;
use Icinga\Exception\NotFoundError;
use InvalidArgumentException;
use LogicException;
use Zend_Form_Element;
@ -170,10 +171,10 @@ class RoleForm extends ConfigForm
throw new LogicException(sprintf('Can\'t load role \'%s\'. Config is not set', $name));
}
if (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(sprintf(
throw new NotFoundError(
$this->translate('Can\'t load role \'%s\'. Role does not exist'),
$name
));
);
}
$role = $this->config->getSection($name)->toArray();
$role['permissions'] = ! empty($role['permissions'])