diff --git a/js/id/core/connection.js b/js/id/core/connection.js index ad7478e50..7de2e5621 100644 --- a/js/id/core/connection.js +++ b/js/id/core/connection.js @@ -42,10 +42,10 @@ iD.Connection = function() { }; connection.loadFromURL = function(url, callback) { - function done(dom) { - return callback(null, parse(dom)); + function done(err, dom) { + return callback(err, parse(dom)); } - return d3.xml(url).get().on('load', done); + return d3.xml(url).get(done); }; connection.loadEntity = function(id, callback) { @@ -137,7 +137,7 @@ iD.Connection = function() { }; function parse(dom) { - if (!dom || !dom.childNodes) return new Error('Bad request'); + if (!dom || !dom.childNodes) return; var root = dom.childNodes[0], children = root.childNodes, diff --git a/js/id/id.js b/js/id/id.js index 2bea474aa..5536cae14 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -55,10 +55,12 @@ window.iD = function () { } connection.on('load.context', function loadContext(err, result) { - if (altGraph) { - _.each(result.data, function(entity) { altGraph.replace(entity); }); - } else { - history.merge(result.data, result.extent); + if (!err) { + if (altGraph) { + _.each(result.data, function(entity) { altGraph.replace(entity); }); + } else { + history.merge(result.data, result.extent); + } } });