mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Connection.loadFromURL was swallowing all the errors instead of passing them along
This commit is contained in:
@@ -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,
|
||||
|
||||
+6
-4
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user