osm-search / Nominatim-Data-Analyser-Frontend

Frontend of the QA Tool for Nominatim. Helps to improve the OpenStreetMap data quality and therefore the Nominatim search results.
GNU General Public License v2.0
3 stars 3 forks source link

Prevent crashes when fetching layer files without CORS header. #13

Closed AntoJvlt closed 3 years ago

AntoJvlt commented 3 years ago

Fixes #10

Manually catch exceptions raised by the fetch() method when receiving responses without CORS header (only inside the LayersList component).

This was especially problematic when one specific layer.json file doesn't exist on the server, if the 404 response returned doesn't contain a CORS header, the fetch() method doesn't accept the response and raise an exception. See stackoverflow.

A warning is now displayed in the console instead of crashing the app.