move error messages to consistent 'userError' function and return 400 Bad Request

This commit is contained in:
Brian Quinion
2012-11-06 13:16:19 +00:00
parent 9d8ee88591
commit e70dfa18fa
2 changed files with 17 additions and 4 deletions

View File

@@ -25,6 +25,19 @@
}
function userError($sError)
{
header('HTTP/1.0 400 Bad Request');
header('Content-type: text/html; charset=utf-8');
echo "<html><body><h1>Bad Request</h1>";
echo '<p>Nominatim has encountered an error with your request.</p>';
echo "<p><b>Details:</b> ".$sError,"</p>";
echo '<p>If you feel this error is incorrect feel free to report the bug in the <a href="http://trac.openstreetmap.org">OSM bug database</a>. Please include the error message above and the URL you used.</p>';
echo "\n</body></html>\n";
exit;
}
function fail($sError, $sUserError = false)
{
if (!$sUserError) $sUserError = $sError;