Improved error handling

merge-requests/267/head
Eliot Berriot 2018-06-21 19:22:03 +02:00
rodzic bf8b143700
commit e3e0a2eaf4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
1 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -86,11 +86,15 @@ axios.interceptors.response.use(function (response) {
} else if (error.response.status === 500) {
error.backendErrors.push('A server error occured')
} else if (error.response.data) {
for (var field in error.response.data) {
if (error.response.data.hasOwnProperty(field)) {
error.response.data[field].forEach(e => {
error.backendErrors.push(e)
})
if (error.response.data.detail) {
error.backendErrors.push(error.response.data.detail)
} else {
for (var field in error.response.data) {
if (error.response.data.hasOwnProperty(field)) {
error.response.data[field].forEach(e => {
error.backendErrors.push(e)
})
}
}
}
}