ipl/Web: avoid Icinga Exceptions
This commit is contained in:
parent
3d1ccf17a3
commit
0026e7fd61
|
@ -113,8 +113,8 @@ trait ControlsAndContentHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $title
|
||||
* @param null $url
|
||||
* @param string $title
|
||||
* @param mixed $url
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -161,7 +161,9 @@ trait ControlsAndContentHelper
|
|||
*/
|
||||
protected function getUrlFromRequest()
|
||||
{
|
||||
$webUrl = $this->getRequest()->getUrl();
|
||||
/** @var \Icinga\Web\Request $request */
|
||||
$request = $this->getRequest();
|
||||
$webUrl = $request->getUrl();
|
||||
|
||||
return Url::fromPath(
|
||||
$webUrl->getPath()
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace dipl\Web;
|
||||
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Web\Request;
|
||||
use RuntimeException;
|
||||
|
||||
class FakeRequest extends Request
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ class FakeRequest extends Request
|
|||
public function getBaseUrl($raw = false)
|
||||
{
|
||||
if (self::$baseUrl === null) {
|
||||
throw new ProgrammingError('Cannot determine base URL on CLI if not configured');
|
||||
throw new RuntimeException('Cannot determine base URL on CLI if not configured');
|
||||
} else {
|
||||
return self::$baseUrl;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ namespace dipl\Web\Widget;
|
|||
use dipl\Html\BaseHtmlElement;
|
||||
use dipl\Html\Html;
|
||||
use dipl\Html\HtmlDocument;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use RuntimeException;
|
||||
|
||||
class Controls extends BaseHtmlElement
|
||||
{
|
||||
|
@ -33,7 +35,6 @@ class Controls extends BaseHtmlElement
|
|||
* @param $title
|
||||
* @param null $subTitle
|
||||
* @return $this
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
public function addTitle($title, $subTitle = null)
|
||||
{
|
||||
|
@ -48,7 +49,6 @@ class Controls extends BaseHtmlElement
|
|||
/**
|
||||
* @param BaseHtmlElement $element
|
||||
* @return $this
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
public function setTitleElement(BaseHtmlElement $element)
|
||||
{
|
||||
|
@ -92,7 +92,6 @@ class Controls extends BaseHtmlElement
|
|||
/**
|
||||
* @param Tabs $tabs
|
||||
* @return $this
|
||||
* @throws \Icinga\Exception\ProgrammingError
|
||||
*/
|
||||
public function prependTabs(Tabs $tabs)
|
||||
{
|
||||
|
@ -102,7 +101,12 @@ class Controls extends BaseHtmlElement
|
|||
$current = $this->tabs->getTabs();
|
||||
$this->tabs = $tabs;
|
||||
foreach ($current as $name => $tab) {
|
||||
$this->tabs->add($name, $tab);
|
||||
try {
|
||||
// TODO: Use ipl-based tabs
|
||||
$this->tabs->add($name, $tab);
|
||||
} catch (ProgrammingError $e) {
|
||||
throw new RuntimeException($e->getMessage(), 0, $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +115,6 @@ class Controls extends BaseHtmlElement
|
|||
|
||||
/**
|
||||
* @return ActionBar
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
public function getActionBar()
|
||||
{
|
||||
|
@ -125,7 +128,6 @@ class Controls extends BaseHtmlElement
|
|||
/**
|
||||
* @param HtmlDocument $actionBar
|
||||
* @return $this
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
public function setActionBar(HtmlDocument $actionBar)
|
||||
{
|
||||
|
@ -141,7 +143,6 @@ class Controls extends BaseHtmlElement
|
|||
|
||||
/**
|
||||
* @return BaseHtmlElement
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
protected function renderTitleElement()
|
||||
{
|
||||
|
@ -157,7 +158,6 @@ class Controls extends BaseHtmlElement
|
|||
|
||||
/**
|
||||
* @return string
|
||||
* @throws \Icinga\Exception\IcingaException
|
||||
*/
|
||||
public function renderContent()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue