Skip to content

Commit ecc0395

Browse files
committed
handler error in get-topojson Promise with reject
1 parent f099117 commit ecc0395

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/plots/geo/geo.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,22 @@ proto.plot = function(geoData, fullLayout, promises) {
100100
_this.topojsonName
101101
);
102102

103-
promises.push(new Promise(function(resolve) {
103+
promises.push(new Promise(function(resolve, reject) {
104104
d3.json(topojsonPath, function(error, topojson) {
105105
if(error) {
106106
if(error.status === 404) {
107-
console.error([
107+
reject(Error([
108108
'plotly.js could not find topojson file at',
109109
topojsonPath, '.',
110110
'Make sure the *topojsonURL* plot config option',
111111
'is set properly.'
112-
].join(' '));
112+
].join(' ')));
113+
}
114+
else {
115+
reject(Error([
116+
'unexpected error while fetching topojson file at',
117+
topojsonPath
118+
].join(' ')));
113119
}
114120
return;
115121
}

0 commit comments

Comments
 (0)