<?php
-/* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
and is published under the AGPL license. */
class ErrorController extends Zend_Controller_Action
{
protected function httpError($code) {
$this->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->view->headLink()->appendStylesheet('css/generic.css', 'all');
+ $this->view->headLink()->appendStylesheet('css/error.css', 'all');
}
public function errorAction() {
$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