mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
dfd8c91827
commit
25736cf76e
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
|
use Icinga\Exception\MissingParameterException;
|
||||||
use Icinga\Security\SecurityException;
|
use Icinga\Security\SecurityException;
|
||||||
use Icinga\Web\Controller\ActionController;
|
use Icinga\Web\Controller\ActionController;
|
||||||
|
|
||||||
@ -42,19 +43,26 @@ class ErrorController extends ActionController
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER:
|
|
||||||
if ($exception instanceof SecurityException) {
|
|
||||||
$this->getResponse()->setHttpResponseCode(403);
|
|
||||||
$this->view->message = $exception->getMessage();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Move to default
|
|
||||||
default:
|
default:
|
||||||
|
switch (true) {
|
||||||
|
case $exception instanceof SecurityException:
|
||||||
|
$this->getResponse()->setHttpResponseCode(403);
|
||||||
|
break;
|
||||||
|
case $exception instanceof MissingParameterException:
|
||||||
|
$this->getResponse()->setHttpResponseCode(400);
|
||||||
|
$this->getResponse()->setHeader(
|
||||||
|
'X-Status-Reason',
|
||||||
|
'Missing parameter ' . $exception->getParameter()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->getResponse()->setHttpResponseCode(500);
|
||||||
|
break;
|
||||||
|
}
|
||||||
$title = preg_replace('/\r?\n.*$/s', '', $exception->getMessage());
|
$title = preg_replace('/\r?\n.*$/s', '', $exception->getMessage());
|
||||||
$this->getResponse()->setHttpResponseCode(500);
|
|
||||||
$this->view->title = 'Server error: ' . $title;
|
$this->view->title = 'Server error: ' . $title;
|
||||||
$this->view->message = $exception->getMessage();
|
$this->view->message = $exception->getMessage();
|
||||||
if ($this->getInvokeArg('displayExceptions') == true) {
|
if ($this->getInvokeArg('displayExceptions')) {
|
||||||
$this->view->stackTrace = $exception->getTraceAsString();
|
$this->view->stackTrace = $exception->getTraceAsString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user