mirror of
https://github.com/strapi/strapi.git
synced 2025-10-17 02:53:22 +00:00
Merge pull request #13976 from strapi/fix/upload-proxy-error-gracefully
Upload: Handle file upload errors gracefully
This commit is contained in:
commit
eb7dbd39d7
@ -108,10 +108,21 @@ export const UploadingAssetCard = ({
|
||||
</Card>
|
||||
{error ? (
|
||||
<Typography variant="pi" fontWeight="bold" textColor="danger600">
|
||||
{formatMessage({
|
||||
id: getTrad(`apiError.${error.response.data.error.message}`),
|
||||
defaultMessage: error.response.data.error.message,
|
||||
})}
|
||||
{formatMessage(
|
||||
error?.response?.data?.error?.message
|
||||
? {
|
||||
id: getTrad(`apiError.${error.response.data.error.message}`),
|
||||
defaultMessage: error.response.data.error.message,
|
||||
/* See issue: https://github.com/strapi/strapi/issues/13867
|
||||
A proxy might return an error, before the request reaches Strapi
|
||||
and therefore we need to handle errors gracefully.
|
||||
*/
|
||||
}
|
||||
: {
|
||||
id: getTrad('upload.generic-error'),
|
||||
defaultMessage: 'An error occured while uploading the file.',
|
||||
}
|
||||
)}
|
||||
</Typography>
|
||||
) : (
|
||||
undefined
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"apiError.FileTooBig": "The uploaded file exceeds the maximum allowed asset size.",
|
||||
"upload.generic-error": "An error occurred while uploading the file.",
|
||||
"bulk.select.label": "Select all assets",
|
||||
"button.next": "Next",
|
||||
"checkControl.crop-duplicate": "Duplicate & crop the asset",
|
||||
|
Loading…
x
Reference in New Issue
Block a user