Add SystemPermissionException

This exception should be fired when the OS restricts the web user
from executing certain actions. Also the template for errors has
been modified so it displays the action and the target that
was prevented.

refs 
This commit is contained in:
Jannis Moßhammer 2013-06-20 13:47:51 +02:00 committed by Marius Hein
parent 8d1038e622
commit 0f8648dcb1
3 changed files with 32 additions and 4 deletions
application
controllers
views/scripts/error
library/Icinga/Exception

@ -34,7 +34,6 @@ class ErrorController extends ActionController
$this->view->message = 'Application error';
break;
}
// conditionally display exceptions
if ($this->getInvokeArg('displayExceptions') == true) {
$this->view->exception = $errors->exception;
@ -44,4 +43,4 @@ class ErrorController extends ActionController
}
}
// @codingStandardsIgnoreEnd
// @codingStandardsIgnoreEnd

@ -9,8 +9,15 @@
<div style="text-align:left;">
<h3>Exception information:</h3>
<p >
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
<p>
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
<?php if (isset($this->exception->action)): ?>
<br/><b>Action</b>: <?= $this->exception->action; ?>
<?php endif ?>
<?php if (isset($this->exception->action)): ?>
<br/><b>Target</b>: <?= $this->exception->target; ?>
<?php endif ?>
</p>
<h3>Stack trace:</h3>

@ -0,0 +1,22 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Exception;
/**
* Class ProgrammingError
* @package Icinga\Exception
*/
class SystemPermissionException extends \Exception
{
public $action;
public $target;
public function __construct($message, $action, $target = "")
{
parent::__construct($message);
$this->action = $action;
$this->target = $target;
}
}