error handling

This commit is contained in:
Norbert Renner 2014-08-01 17:44:57 +02:00
parent a5e1681370
commit fd98a2f102
2 changed files with 25 additions and 10 deletions

View file

@ -138,9 +138,18 @@
routing = new BR.Routing({routing: {
router: L.bind(router.getRouteSegment, router)
}});
routing.on('routing:routeWaypointEnd', onUpdate);
routing.on('routing:routeWaypointEnd', function(evt) {
onUpdate(evt && evt.err);
});
function onUpdate() {
function onUpdate(err) {
if (err) {
BR.message.showError(err);
return;
} else {
BR.message.hideError();
}
var track = routing.toPolyline(),
latLngs = routing.getWaypoints(),
urls = {};