]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/router.js
Throw an exception instead of logging to the console
[rails.git] / app / assets / javascripts / router.js
index cadb6b628f1b672fa9dd46aaa6a2adf5279ddca1..56616c2694d4cbe94ecd6dc2bb2dc8e590e73af5 100644 (file)
@@ -169,8 +169,12 @@ OSM.Router = function(map, rts) {
   };
 
   router.load = function() {
-    var loadState = currentRoute.run('load', currentPath);
-    router.stateChange(loadState || {});
+    if (currentRoute) {
+      var loadState = currentRoute.run('load', currentPath);
+      router.stateChange(loadState || {});
+    } else {
+      throw "Unable to match route for: " + currentPath;
+    }
   };
 
   map.on('moveend baselayerchange overlaylayerchange', router.updateHash);