mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-15 19:07:58 +00:00
introduce custom UsageError
This is a exception to be thrown when the error occures because of bad user data. We don't want to print a full stack trace in these cases but just tell the user what went wrong.
This commit is contained in:
@@ -6,9 +6,10 @@ import datetime as dt
|
||||
import pytest
|
||||
|
||||
import nominatim.db.status
|
||||
from nominatim.errors import UsageError
|
||||
|
||||
def test_compute_database_date_place_empty(status_table, place_table, temp_db_conn):
|
||||
with pytest.raises(RuntimeError):
|
||||
with pytest.raises(UsageError):
|
||||
nominatim.db.status.compute_database_date(temp_db_conn)
|
||||
|
||||
OSM_NODE_DATA = """\
|
||||
@@ -44,7 +45,7 @@ def test_compute_database_broken_api(monkeypatch, status_table, place_row, temp_
|
||||
|
||||
monkeypatch.setattr(nominatim.db.status, "get_url", mock_url)
|
||||
|
||||
with pytest.raises(RuntimeError):
|
||||
with pytest.raises(UsageError):
|
||||
date = nominatim.db.status.compute_database_date(temp_db_conn)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user