_getParam('error_handler'); $exception = $error->exception; Logger::error($exception); Logger::error('Stacktrace: %s', $exception->getTraceAsString()); switch ($error->type) { case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: $modules = Icinga::app()->getModuleManager(); $path = ltrim($this->_request->get('PATH_INFO'), '/'); $path = preg_split('~/~', $path); $path = array_shift($path); $this->getResponse()->setHttpResponseCode(404); $this->view->message = $this->translate('Page not found.'); if ($this->Auth()->isAuthenticated() && $modules->hasInstalled($path) && ! $modules->hasEnabled($path)) { $this->view->message .= ' ' . sprintf( $this->translate('Enabling the "%s" module might help!'), $path ); } break; default: switch (true) { case $exception instanceof HttpMethodNotAllowedException: $this->getResponse()->setHttpResponseCode(405); $this->getResponse()->setHeader('Allow', $exception->getAllowedMethods()); break; case $exception instanceof HttpNotFoundException: $this->getResponse()->setHttpResponseCode(404); break; case $exception instanceof MissingParameterException: $this->getResponse()->setHttpResponseCode(400); $this->getResponse()->setHeader( 'X-Status-Reason', 'Missing parameter ' . $exception->getParameter() ); break; case $exception instanceof SecurityException: $this->getResponse()->setHttpResponseCode(403); break; default: $this->getResponse()->setHttpResponseCode(500); break; } $this->view->message = $exception->getMessage(); if ($this->getInvokeArg('displayExceptions')) { $this->view->stackTrace = $exception->getTraceAsString(); } break; } $this->view->request = $error->request; } }