From: arno Date: Sun, 20 Mar 2011 15:28:22 +0000 (+0100) Subject: fixes: some error were not handled correctly when uploading path as file X-Git-Tag: v0.3~8 X-Git-Url: https://dev.renevier.net/?p=syj.git;a=commitdiff_plain;h=efd74d3cddbac3cb5d317a5e14ba9d70281531c4 fixes: some error were not handled correctly when uploading path as file --- diff --git a/application/controllers/IdxController.php b/application/controllers/IdxController.php index 91606e6..808603d 100644 --- a/application/controllers/IdxController.php +++ b/application/controllers/IdxController.php @@ -115,10 +115,15 @@ class IdxController extends Zend_Controller_Action if ($error->exception instanceof Syj_Exception_ToolargeGeomUpload) { $maxsize = $this->_bytesToString(min($this->_strToBytes(ini_get('upload_max_filesize')), $this->_strToBytes(ini_get('upload_max_filesize')))); - $this->view->errorMsg = $this->view->translate('File too large. File size must not exceed %s', $maxsize); + $errorMsg = __('File too large. File size must not exceed %s', $maxsize); } else if ($error->exception instanceof Syj_Exception_InvalidGeomUpload) { - $this->view->errorMsg = $this->view->translate("Invalid file"); + if ($error->exception->getMessage() === 'uniquepath') { + $errorMsg = __("similar path seems to already exist. Please do not create two exactly identical paths"); + } else { + $errorMsg = __("Invalid file"); + } } + $this->view->errorMsg = $errorMsg; } } diff --git a/application/controllers/PathController.php b/application/controllers/PathController.php index 7d7ae6a..f0ef477 100644 --- a/application/controllers/PathController.php +++ b/application/controllers/PathController.php @@ -78,7 +78,7 @@ class PathController extends Zend_Controller_Action } if ($geom::name != "LineString") { - throw new Syj_Exception_Request(); + throw new Syj_Exception_InvalidGeomUpload(); } $path->geom = $geom; @@ -96,7 +96,7 @@ class PathController extends Zend_Controller_Action if ($e->getCode() == 23505) { // 23505: Unique violation throw new Syj_Exception_Request(); $message = $e->getMessage(); if (strpos($message, 'paths_geom_key') !== false) { - throw new Syj_Exception_Request("uniquepath"); + throw new Syj_Exception_InvalidGeomUpload("uniquepath"); } else { throw $e; } diff --git a/library/gisconverter b/library/gisconverter index 9dc9104..84ceab5 160000 --- a/library/gisconverter +++ b/library/gisconverter @@ -1 +1 @@ -Subproject commit 9dc9104238e2c43341c61a0b974003ca8cd534f5 +Subproject commit 84ceab55aa9984d0406ad6f196726a3f0a5f18cf