diff --git a/lib/lib.php b/lib/lib.php index a7c805f7..d8ff2f64 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -1,5 +1,30 @@

Internal Server Error

"; + echo '

Nominatim has encountered an internal error while processing your request. This is most likely because of a bug in the software.

'; + echo "

Details: ".$sError,"

"; + echo '

Feel free to report the bug in the OSM bug database. Please include the error message above an the URL you used.

'; + if (CONST_Debug) + { + echo "

Debugging Information


"; + if ($sSQL) { + echo "

SQL query

".$sSQL.""; + } + if ($vDumpVar) { + echo "

Result

"; + var_dump($vDumpVar); + echo ""; + } + } + echo "\n\n"; + exit; + + } + function fail($sError, $sUserError = false) { if (!$sUserError) $sUserError = $sError; diff --git a/website/details.php b/website/details.php index 110fdc07..eeb48656 100755 --- a/website/details.php +++ b/website/details.php @@ -48,11 +48,11 @@ $sSQL .= " ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea,ST_GeometryType(geometry) as geotype, ST_Y(ST_Centroid(geometry)) as lat,ST_X(ST_Centroid(geometry)) as lon "; $sSQL .= " from placex where place_id = $iPlaceID"; $aPointDetails = $oDB->getRow($sSQL); - IF (PEAR::IsError($aPointDetails)) + if (PEAR::IsError($aPointDetails)) { - var_dump($aPointDetails); - exit; + failInternalError("Could not get details of place object.", $sSQL, $aPointDetails); } + $aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber']; $fLon = $aPointDetails['lon']; $fLat = $aPointDetails['lat']; @@ -77,8 +77,7 @@ $aPointPolygon = $oDB->getRow($sSQL); IF (PEAR::IsError($aPointPolygon)) { - var_dump($aPointPolygon); - exit; + failInternalError("Could not get bounding box of place object.", $sSQL, $aPointPolygon); } if (preg_match('#POLYGON\\(\\(([- 0-9.,]+)#',$aPointPolygon['outlinestring'],$aMatch)) { diff --git a/website/reverse.php b/website/reverse.php index f569ffac..d9ecc09e 100755 --- a/website/reverse.php +++ b/website/reverse.php @@ -105,8 +105,7 @@ $iPlaceID = $aPlace['place_id']; if (PEAR::IsError($iPlaceID)) { - var_Dump($sSQL, $iPlaceID); - exit; + failInternalError("Could not determine closest place.", $sSQL, $iPlaceID); } } @@ -118,8 +117,7 @@ $iPlaceID = $oDB->getOne($sSQL); if (PEAR::IsError($iPlaceID)) { - var_Dump($sSQL, $iPlaceID); - exit; + failInternalError("Could not get parent for place.", $sSQL, $iPlaceID); } if ($iPlaceID && $aPlace['place_id'] && $iMaxRank < 28) @@ -129,8 +127,7 @@ $iPlaceID = $oDB->getOne($sSQL); if (PEAR::IsError($iPlaceID)) { - var_Dump($sSQL, $iPlaceID); - exit; + failInternalError("Could not get larger parent for place.", $sSQL, $iPlaceID); } } if (!$iPlaceID) diff --git a/website/search.php b/website/search.php index d9adf6b8..50d009e1 100755 --- a/website/search.php +++ b/website/search.php @@ -163,8 +163,7 @@ $sViewboxSmallSQL = $oDB->getOne($sSQL); if (PEAR::isError($sViewboxSmallSQL)) { - var_dump($sViewboxSmallSQL); - exit; + failInternalError("Could not get small viewbox.", $sSQL, $sViewboxSmallSQL); } $sViewboxSmallSQL = "'".$sViewboxSmallSQL."'::geometry"; @@ -172,8 +171,7 @@ $sViewboxLargeSQL = $oDB->getOne($sSQL); if (PEAR::isError($sViewboxLargeSQL)) { - var_dump($sViewboxLargeSQL); - exit; + failInternalError("Could not get large viewbox.", $sSQL, $sViewboxLargeSQL); } $sViewboxLargeSQL = "'".$sViewboxLargeSQL."'::geometry"; } @@ -324,8 +322,7 @@ $aDatabaseWords = array(); if (PEAR::IsError($aDatabaseWords)) { - var_dump($sSQL, $aDatabaseWords); - exit; + failInternalError("Could not get word tokens.", $sSQL, $aDatabaseWords); } $aPossibleMainWordIDs = array(); foreach($aDatabaseWords as $aToken) @@ -789,8 +786,7 @@ $aViewBoxPlaceIDs = $oDB->getAll($sSQL); if (PEAR::IsError($aViewBoxPlaceIDs)) { - var_dump($sSQL, $aViewBoxPlaceIDs); - exit; + failInternalError("Could not get places for search terms.", $sSQL, $aViewBoxPlaceIDs); } //var_dump($aViewBoxPlaceIDs); // Did we have an viewbox matches? @@ -971,8 +967,7 @@ if (PEAR::IsError($aPlaceIDs)) { - var_dump($sSQL, $aPlaceIDs); - exit; + failInternalError("Could not get place IDs from tokens." ,$sSQL, $aPlaceIDs); } if (CONST_Debug) var_Dump($aPlaceIDs); @@ -1048,8 +1043,7 @@ if (PEAR::IsError($aSearchResults)) { - var_dump($sSQL, $aSearchResults); - exit; + failInternalError("Could not get details for place.", $sSQL, $aSearchResults); } } } // end if ($sQuery) @@ -1117,8 +1111,7 @@ if (PEAR::IsError($aSearchResults)) { - var_dump($sSQL, $aSearchResults); - exit; + failInternalError("Could not get details for place (near).", $sSQL, $aSearchResults); } } } @@ -1149,8 +1142,7 @@ $aPointPolygon = $oDB->getRow($sSQL); if (PEAR::IsError($aPointPolygon)) { - var_dump($sSQL, $aPointPolygon); - exit; + failInternalError("Could not get outline.", $sSQL, $aPointPolygon); } if ($aPointPolygon['place_id']) {