]> dev.renevier.net Git - syj.git/commitdiff
fixes: some error were not handled correctly when uploading path as file
authorarno <arno@renevier.net>
Sun, 20 Mar 2011 15:28:22 +0000 (16:28 +0100)
committerarno <arno@renevier.net>
Sun, 20 Mar 2011 15:28:22 +0000 (16:28 +0100)
application/controllers/IdxController.php
application/controllers/PathController.php
library/gisconverter

index 91606e61ebeb7e93898f2e23b69b931f2986037a..808603db8368247a5be7d8ab024e9699292e6c58 100644 (file)
@@ -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;
         }
     }
 
index 7d7ae6af8cd2bb843fa707195671bd627a876f3b..f0ef477e0969fdd32a6911aced09276a453ed689 100644 (file)
@@ -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;
                 }
index 9dc9104238e2c43341c61a0b974003ca8cd534f5..84ceab55aa9984d0406ad6f196726a3f0a5f18cf 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9dc9104238e2c43341c61a0b974003ca8cd534f5
+Subproject commit 84ceab55aa9984d0406ad6f196726a3f0a5f18cf