Handle CORS errors with an explicit message

Fix #1026
This commit is contained in:
David Larlet 2023-06-27 11:59:38 -04:00
parent 5b151296e2
commit 14830b867b
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD

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' })
}
}