Skip to content

Commit

Permalink
Merge branch 'main' into E-04823-Tickets-B-18472-And-B-18457-MAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
traskowskycaci authored Feb 22, 2024
2 parents 83dec76 + c67354d commit 823edc5
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/pages/PrimeUI/MoveTaskOrder/MoveDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,25 @@ const MoveDetails = ({ setFlashMessage }) => {
},
onError: (error) => {
const { response: { body } = {} } = error;

if (body) {
setErrorMessage({
title: `Prime API: ${body.title} `,
detail: `${body.detail}`,
});
} else if (error.response.status === 422) {
setErrorMessage({
title: 'Unprocessable Entity Error: ',
detail: `There are no ${documentTypeKey} for this move to download.`,
});
} else {
setErrorMessage({
title: 'Unexpected error: ',
detail: 'Please check the move order document user uploads for this move.',
});
// Error message is coming in as byte array(PDF).
// Need to convert byte array into text/json.
(async () => {
let title = 'Unexpected Error: ';
if (error.response.status === 422) {
title = 'Unprocessable Entity Error: ';
}
const text = await error.response.data.text();
setErrorMessage({
title,
detail: JSON.parse(text).detail,
});
})();
}
},
});
Expand Down

0 comments on commit 823edc5

Please sign in to comment.