mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
Merge pull request #1867 from umap-project/catch-xml-error
fix: show message in case of xml parsing error
This commit is contained in:
commit
3a12865d62
1 changed files with 8 additions and 1 deletions
|
@ -933,7 +933,14 @@ U.DataLayer = L.Evented.extend({
|
|||
},
|
||||
|
||||
rawToGeoJSON: function (c, type, callback) {
|
||||
const toDom = (x) => new DOMParser().parseFromString(x, 'text/xml')
|
||||
const toDom = (x) => {
|
||||
const doc = new DOMParser().parseFromString(x, 'text/xml')
|
||||
const errorNode = doc.querySelector('parsererror')
|
||||
if (errorNode) {
|
||||
this.map.alert.open({ content: L._('Cannot parse data'), level: 'error' })
|
||||
}
|
||||
return doc
|
||||
}
|
||||
|
||||
// TODO add a duck typing guessType
|
||||
if (type === 'csv') {
|
||||
|
|
Loading…
Reference in a new issue