diff --git a/js/router/BRouter.js b/js/router/BRouter.js index 1b49234..a615e03 100644 --- a/js/router/BRouter.js +++ b/js/router/BRouter.js @@ -69,16 +69,6 @@ L.BRouter = L.Class.extend({ return url; }, - _getError: function(xhr) { - var msg = 'no response from server'; - if (xhr.responseText) { - msg = xhr.responseText; - } else if (this.status || this.statusText) { - msg = this.status + ': ' + this.statusText; - } - return new Error(msg); - }, - getRoute: function(latLngs, cb) { var url = this.getUrl(latLngs), xhr = new XMLHttpRequest(); @@ -90,7 +80,7 @@ L.BRouter = L.Class.extend({ xhr.open('GET', url, true); xhr.onload = L.bind(this._handleRouteResponse, this, xhr, cb); xhr.onerror = L.bind(function(xhr, cb) { - cb(this._getError(xhr)); + cb(BR.Util.getError(xhr)); }, this, xhr, cb); xhr.send(); }, @@ -112,7 +102,7 @@ L.BRouter = L.Class.extend({ return cb(null, layer); } else { - cb(this._getError(xhr)); + cb(BR.Util.getError(xhr)); } },