mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
php: force use of global Exception class
This commit is contained in:
@@ -12,7 +12,7 @@ require_once(CONST_Debug ? 'DebugHtml.php' : 'DebugNone.php');
|
|||||||
|
|
||||||
function userError($sMsg)
|
function userError($sMsg)
|
||||||
{
|
{
|
||||||
throw new Exception($sMsg, 400);
|
throw new \Exception($sMsg, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ function shutdown_exception_handler_xml()
|
|||||||
{
|
{
|
||||||
$error = error_get_last();
|
$error = error_get_last();
|
||||||
if ($error !== null && $error['type'] === E_ERROR) {
|
if ($error !== null && $error['type'] === E_ERROR) {
|
||||||
exception_handler_xml(new Exception($error['message'], 500));
|
exception_handler_xml(new \Exception($error['message'], 500));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ function shutdown_exception_handler_json()
|
|||||||
{
|
{
|
||||||
$error = error_get_last();
|
$error = error_get_last();
|
||||||
if ($error !== null && $error['type'] === E_ERROR) {
|
if ($error !== null && $error['type'] === E_ERROR) {
|
||||||
exception_handler_json(new Exception($error['message'], 500));
|
exception_handler_json(new \Exception($error['message'], 500));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ class Tokenizer
|
|||||||
$sSQL = 'SELECT word_id FROM word limit 1';
|
$sSQL = 'SELECT word_id FROM word limit 1';
|
||||||
$iWordID = $this->oDB->getOne($sSQL);
|
$iWordID = $this->oDB->getOne($sSQL);
|
||||||
if ($iWordID === false) {
|
if ($iWordID === false) {
|
||||||
throw new Exception('Query failed', 703);
|
throw new \Exception('Query failed', 703);
|
||||||
}
|
}
|
||||||
if (!$iWordID) {
|
if (!$iWordID) {
|
||||||
throw new Exception('No value', 704);
|
throw new \Exception('No value', 704);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,20 +19,20 @@ class Tokenizer
|
|||||||
{
|
{
|
||||||
$sStandardWord = $this->oDB->getOne("SELECT make_standard_name('a')");
|
$sStandardWord = $this->oDB->getOne("SELECT make_standard_name('a')");
|
||||||
if ($sStandardWord === false) {
|
if ($sStandardWord === false) {
|
||||||
throw new Exception('Module failed', 701);
|
throw new \Exception('Module failed', 701);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sStandardWord != 'a') {
|
if ($sStandardWord != 'a') {
|
||||||
throw new Exception('Module call failed', 702);
|
throw new \Exception('Module call failed', 702);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sSQL = "SELECT word_id FROM word WHERE word_token IN (' a')";
|
$sSQL = "SELECT word_id FROM word WHERE word_token IN (' a')";
|
||||||
$iWordID = $this->oDB->getOne($sSQL);
|
$iWordID = $this->oDB->getOne($sSQL);
|
||||||
if ($iWordID === false) {
|
if ($iWordID === false) {
|
||||||
throw new Exception('Query failed', 703);
|
throw new \Exception('Query failed', 703);
|
||||||
}
|
}
|
||||||
if (!$iWordID) {
|
if (!$iWordID) {
|
||||||
throw new Exception('No value', 704);
|
throw new \Exception('No value', 704);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ if ($sOsmType && $iOsmId > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($sPlaceId === false) {
|
if ($sPlaceId === false) {
|
||||||
throw new Exception('No place with that OSM ID found.', 404);
|
throw new \Exception('No place with that OSM ID found.', 404);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sPlaceId === false) {
|
if ($sPlaceId === false) {
|
||||||
@@ -146,7 +146,7 @@ $sSQL .= " WHERE place_id = $iPlaceID";
|
|||||||
$aPointDetails = $oDB->getRow($sSQL, null, 'Could not get details of place object.');
|
$aPointDetails = $oDB->getRow($sSQL, null, 'Could not get details of place object.');
|
||||||
|
|
||||||
if (!$aPointDetails) {
|
if (!$aPointDetails) {
|
||||||
throw new Exception('No place with that place ID found.', 404);
|
throw new \Exception('No place with that place ID found.', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
|
$aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
|
||||||
|
|||||||
Reference in New Issue
Block a user