Skip to content

Commit

Permalink
fix: error message on v1 response
Browse files Browse the repository at this point in the history
  • Loading branch information
Kizito007 committed Dec 18, 2024
1 parent d8b3353 commit becb9b9
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/VectorBasemapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,21 @@ export var VectorBasemapLayer = VectorTileLayer.extend({
} else {
styleUrl = getBasemapStyleUrl(this.options.key, this.options.apikey);
}
// show error warning on successful response
fetch(styleUrl)
.then(response => {
return response.json();
})
.then(styleData => {
if (styleData.error) {
console.warn('Error:', styleData.error.message);
}
})
.catch(err => {
console.warn('Error:', err.message);
});
// show error warning on successful response for previous version(1)
if (this.options.version && this.options.version === 1) {
fetch(styleUrl)
.then(response => {
return response.json();
})
.then(styleData => {
if (styleData.error) {
console.warn('Error:', styleData.error.message);
}
})
.catch(error => {
console.warn('Error:', error.message);
});
}
this._createMaplibreLayer(styleUrl);
},

Expand Down

0 comments on commit becb9b9

Please sign in to comment.