X-Git-Url: https://dev.renevier.net/?p=syj.git;a=blobdiff_plain;f=application%2Fcontrollers%2FErrorController.php;h=0a6c46868f402bef9e45771c31a9781b4942dbc2;hp=7e0301539129575891f1c6ae7c3e1e26c3d82b7a;hb=00c2579ade64a20ba2d82e98d3eea5f864864cdb;hpb=26afcb880ff75743abcb627ecf516b6c51a36d08 diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index 7e03015..0a6c468 100644 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -1,18 +1,16 @@ getResponse()->setHttpResponseCode($code); - $this->view->message = Zend_Http_Response::responseCodeAsText($code); } public function init() { $this->_helper->SyjReset->resetPlaceHolders(); - $this->view->headLink()->appendStylesheet('css/generic.css'); - $this->view->headLink()->appendStylesheet('css/error.css'); + $this->_helper->SyjMedias->addStyleSheets('error'); } public function errorAction() { @@ -30,6 +28,8 @@ class ErrorController extends Zend_Controller_Action $error_code = 400; // Bad Request } else if ($error->exception instanceof Syj_Exception_Forbidden) { $error_code = 403; // Forbidden + } else if ($error->exception instanceof Syj_Exception_NotImplemented) { + $error_code = 501; // Not Implemented } else if ($error->exception instanceof Syj_Exception_NotFound) { $error_code = $error->exception->getCode(); } @@ -42,8 +42,13 @@ class ErrorController extends Zend_Controller_Action $log->crit($this->view->message, $error->exception); } - if ($error_code != 404 and $error_code != 410 and $error->request->isXmlHttpRequest()) { + if ($error_code == 400 and $error->request->isXmlHttpRequest()) { return $this->_helper->json(array('message' => $error->exception->getMessage())); + } else if ($error->exception instanceof Syj_Exception_InvalidGeomUpload) { + // invalid file upload: we will redirect to main page + $this->_helper->SyjReset->resetPlaceHolders(); + $this->_request->setControllerName('idx')->setActionName('error')->setDispatched(false); + return; } // conditionally display exceptions