mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-26 22:44:44 +03:00
Merge pull request #2182 from lonvia/change-error-for-details
Return 404 for details when no object is found in database
This commit is contained in:
commit
68c3862270
@ -81,11 +81,16 @@ if ($sOsmType && $iOsmId > 0) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
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.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($sPlaceId === false) userError('Please select a place id');
|
||||
|
||||
$iPlaceID = (int)$sPlaceId;
|
||||
|
||||
if (CONST_Use_US_Tiger_Data) {
|
||||
@ -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'];
|
||||
|
@ -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 |
|
||||
|
Loading…
Reference in New Issue
Block a user