Handle missing item in find nearby OSM API call

This commit is contained in:
Edward Betts 2021-07-22 09:49:24 +02:00
parent 480df60d24
commit 8b7ab45c73

View file

@ -348,6 +348,11 @@ def api_find_osm_candidates(item_id):
t0 = time() t0 = time()
bounds = read_bounds_param() bounds = read_bounds_param()
item = model.Item.query.get(item_id) item = model.Item.query.get(item_id)
if not item:
return cors_jsonify(success=True,
qid=f'Q{item_id}',
error="item doesn't exist")
nearby = api.find_osm_candidates(item, bounds) nearby = api.find_osm_candidates(item, bounds)
t1 = time() - t0 t1 = time() - t0