Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
Hotfix: reverse geocoding error handling was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
tituomin committed Apr 26, 2018
1 parent 264fbd1 commit ebd064c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/map-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,13 @@ define (require) ->
.setContent popupContents
name: address

positionObject.reverseGeocode?().done =>
success = =>
popup.setContent popupContents
name: positionObject.humanAddress()
error = =>
popup.setContent popupContents
name: i18n.t('map.unknown_address')
positionObject.reverseGeocode?().done(success).fail(error)
popup

createStatisticsPopup: (positionObject, statistic) ->
Expand Down
3 changes: 2 additions & 1 deletion src/models.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ define (require) ->
@listenTo posList, 'sync', =>
bestMatch = posList.first()
if bestMatch.get('distance') > 500
bestMatch.set 'name', i18n.t 'map.unknown_address'
deferred.reject()
return
@set bestMatch.toJSON()
deferred.resolve()
@trigger 'reverse-geocode'
Expand Down

0 comments on commit ebd064c

Please sign in to comment.