From 13131cb3f6d70040f633a322a8e490489fc8479f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 27 Aug 2015 13:57:10 +0200 Subject: [PATCH] Throw NotFoundError instead of InvalidArgumentException in RoleForm::load() --- application/forms/Security/RoleForm.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/forms/Security/RoleForm.php b/application/forms/Security/RoleForm.php index dba7ebe9f..8a9ee4187 100644 --- a/application/forms/Security/RoleForm.php +++ b/application/forms/Security/RoleForm.php @@ -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'])