]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #2185 from lonvia/fix-deadlock-handling-for-psycopg27
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 25 Feb 2021 17:39:40 +0000 (18:39 +0100)
committerGitHub <noreply@github.com>
Thu, 25 Feb 2021 17:39:40 +0000 (18:39 +0100)
Improve deadlock detection for various versions of psycopg2

lib-php/website/details.php
test/bdd/api/details/simple.feature

index 130dcaf81e92945f126969497f405ed216035142..bd7df12c23a7cc936423d930335458e27c187860 100644 (file)
@@ -81,10 +81,15 @@ if ($sOsmType && $iOsmId > 0) {
             exit;
         }
     }
-}
-
 
-if ($sPlaceId === false) userError('Please select a place id');
+    if ($sPlaceId === false) {
+        throw new Exception('No place with that OSM ID found.', 404);
+    }
+} else {
+    if ($sPlaceId === false) {
+        userError('Required parameters missing. Need either osmtype/osmid or place_id.');
+    }
+}
 
 $iPlaceID = (int)$sPlaceId;
 
@@ -140,7 +145,7 @@ $sSQL .= " WHERE place_id = $iPlaceID";
 $aPointDetails = $oDB->getRow($sSQL, null, 'Could not get details of place object.');
 
 if (!$aPointDetails) {
-    userError('Unknown place id.');
+    throw new Exception('No place with that place ID found.', 404);
 }
 
 $aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
index a9b6d6a70553d933e5c3acd0ee01e1a2145e3b10..c38018bcea4506874da8852ded6ae4566a2283f1 100644 (file)
@@ -44,7 +44,7 @@ Feature: Object details
 
     Scenario Outline: Details via unknown OSM id
         When sending details query for <object>
-        Then a HTTP 400 is returned
+        Then a HTTP 404 is returned
 
     Examples:
       | object |