From 19ed1859bdc253bac171ed0a783301e4a48c6b87 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Wed, 25 Jul 2012 19:51:51 +0300 Subject: [PATCH] fix no geolocation error handling --- src/map/ext/Map.Geolocation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/map/ext/Map.Geolocation.js b/src/map/ext/Map.Geolocation.js index 69e6c5fb..bf33f7fa 100644 --- a/src/map/ext/Map.Geolocation.js +++ b/src/map/ext/Map.Geolocation.js @@ -17,10 +17,11 @@ L.Map.include({ options = this._locationOptions = L.Util.extend(this._defaultLocateOptions, options); if (!navigator.geolocation) { - return this.fire('locationerror', { + this._handleGeolocationError({ code: 0, message: "Geolocation not supported." }); + return this; } var onResponse = L.Util.bind(this._handleGeolocationResponse, this), @@ -43,7 +44,7 @@ L.Map.include({ _handleGeolocationError: function (error) { var c = error.code, - message = + message = error.message || (c === 1 ? "permission denied" : (c === 2 ? "position unavailable" : "timeout"));