Objects, FormLoader: exceptions, exceptions

This commit is contained in:
Thomas Gelf 2018-06-14 14:08:04 +02:00
parent 5be3f092a9
commit 9069a7f916
2 changed files with 11 additions and 4 deletions

View File

@ -213,8 +213,8 @@ abstract class ObjectsController extends ActionController
/** /**
* @throws \Icinga\Exception\ConfigurationError * @throws \Icinga\Exception\ConfigurationError
* @throws \Icinga\Exception\Http\HttpNotFoundException * @throws \Icinga\Exception\Http\HttpNotFoundException
* @throws \Icinga\Exception\ProgrammingError
* @throws \Icinga\Security\SecurityException * @throws \Icinga\Security\SecurityException
* @throws NotFoundError
*/ */
public function applyrulesAction() public function applyrulesAction()
{ {
@ -256,6 +256,7 @@ abstract class ObjectsController extends ActionController
* @throws NotFoundError * @throws NotFoundError
* @throws \Icinga\Exception\ConfigurationError * @throws \Icinga\Exception\ConfigurationError
* @throws \Icinga\Exception\Http\HttpNotFoundException * @throws \Icinga\Exception\Http\HttpNotFoundException
* @throws \Icinga\Security\SecurityException
*/ */
public function setsAction() public function setsAction()
{ {
@ -325,7 +326,6 @@ abstract class ObjectsController extends ActionController
* @param string $name * @param string $name
* *
* @return \Icinga\Module\Director\Web\Form\QuickForm * @return \Icinga\Module\Director\Web\Form\QuickForm
* @throws \Icinga\Exception\ProgrammingError
*/ */
public function loadForm($name) public function loadForm($name)
{ {
@ -342,6 +342,7 @@ abstract class ObjectsController extends ActionController
* @param ZfQueryBasedTable $table * @param ZfQueryBasedTable $table
* @return ZfQueryBasedTable * @return ZfQueryBasedTable
* @throws \Icinga\Exception\ConfigurationError * @throws \Icinga\Exception\ConfigurationError
* @throws NotFoundError
*/ */
protected function eventuallyFilterCommand(ZfQueryBasedTable $table) protected function eventuallyFilterCommand(ZfQueryBasedTable $table)
{ {

View File

@ -5,13 +5,18 @@ namespace Icinga\Module\Director\Web\Form;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Application\Modules\Module; use Icinga\Application\Modules\Module;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use RuntimeException;
class FormLoader class FormLoader
{ {
public static function load($name, Module $module = null) public static function load($name, Module $module = null)
{ {
if ($module === null) { if ($module === null) {
try {
$basedir = Icinga::app()->getApplicationDir('forms'); $basedir = Icinga::app()->getApplicationDir('forms');
} catch (ProgrammingError $e) {
throw new RuntimeException($e->getMessage(), 0, $e);
}
$ns = '\\Icinga\\Web\\Forms\\'; $ns = '\\Icinga\\Web\\Forms\\';
} else { } else {
$basedir = $module->getFormDir(); $basedir = $module->getFormDir();
@ -32,6 +37,7 @@ class FormLoader
return new $class($options); return new $class($options);
} }
} }
throw new ProgrammingError(sprintf('Cannot load %s (%s), no such form', $name, $file));
throw new RuntimeException(sprintf('Cannot load %s (%s), no such form', $name, $file));
} }
} }