Merge pull request #1175 from umap-project/1026-cors-error

Handle CORS errors with an explicit message
This commit is contained in:
David Larlet 2023-06-27 15:51:36 -04:00 committed by GitHub
commit a62d88140e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,8 +91,15 @@ L.U.Xhr = L.Evented.extend({
actions: actions,
})
} else {
if (xhr.status !== 0) {
// 0 === request cut by user
if (xhr.status === 0) {
// 0 === request cut by user or CORS
self.ui.alert({
content: L._(
'Issue reaching that URL (network problem or CORS protection)'
),
level: 'error',
})
} else {
self.ui.alert({ content: L._('Problem in the response'), level: 'error' })
}
}