Skip to content

Commit

Permalink
fix(telepac): affiche les erreurs personnalisées plutôt qu'une générique
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot committed Apr 3, 2024
1 parent 80f4329 commit 04af5f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/OperatorSetup/Flow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ describe("OperatorSetupFlow", () => {
})

const error = new AxiosError('Fichier invalide')
error.response = { status : 400 }
error.response = { status : 400, data: { error: 'Votre fichier ne semble pas être une déclaration' } }

axios.__createMock.post.mockRejectedValueOnce(error)

Expand Down
2 changes: 1 addition & 1 deletion src/components/OperatorSetup/Sources/Telepac.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function handleFileUpload () {
emit('upload:complete', { geojson, source, warnings, metadata })
} catch (error) {
if (error.response?.status >= 400 && error.response?.status < 500) {
erreur.value = 'Votre fichier ne semble pas être une déclaration PAC valide.'
erreur.value = error.response.data.error
} else {
erreur.value = 'Erreur inconnue, merci de réessayer plus tard.'
throw error
Expand Down

0 comments on commit 04af5f2

Please sign in to comment.