smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.02k stars 270 forks source link

fix: ensure remote errors in LocationIQ Provider are handled #387

Closed t1m0thy closed 7 months ago

t1m0thy commented 7 months ago

Location IQ throws a 404 error when it is unable to locate any match. such as when typing "san Angl" and there are no places that begin with that string. To repair, the parse method checks for the response.data.error in the response, returns an empty string if it has an error, and otherwise, hands back up to the parent class.

I am new to this library (and not a typescript expert), so while I believe this works, if there is a better way to handle errors, happy to learn!

smeijer commented 7 months ago

Thank you!

smeijer commented 7 months ago

@all-contributors please add @t1m0thy for code

allcontributors[bot] commented 7 months ago

@smeijer

I've put up a pull request to add @t1m0thy! :tada:

smeijer commented 7 months ago

:tada: This PR is included in version 3.11.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: