mapbox / mapbox-gl-directions

Directions plugin for mapbox-gl-js using Mapbox Directions API.
https://mapbox.com/mapbox-gl-js/example/mapbox-gl-directions/
ISC License
237 stars 125 forks source link

Catch 'No Route found' response #278

Closed malwoodsantoro closed 2 years ago

malwoodsantoro commented 2 years ago

Currently routes that return 'No route found' cause the following error:

TypeError: Cannot read property '0' of undefined
  at XMLHttpRequest.request.onload (/mapbox-gl-js/plugins/mapbox-gl-directions/v3.1.1/mapbox-gl-directions.js:5819:44)

image

This change catches these responses and displays the appropriate message to the user (see screenshot above).

malwoodsantoro commented 2 years ago

Hi @avpeery 👋 I wanted to check in on https://github.com/mapbox/mapbox-gl-directions/pull/280 to move this PR forward if possible. Let me know if there is anything I can do to help!

avpeery commented 2 years ago

Hi @avpeery 👋 I wanted to check in on #280 to move this PR forward if possible. Let me know if there is anything I can do to help!

Hi @malwoodsantoro Just revisited the PR and fixed the failing unit test issue, good for review!

avpeery commented 2 years ago

@malwoodsantoro merged in #280 !