Skip to content

Commit

Permalink
Fix: add check for PayloadTooLargeError for media (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderleegs authored Dec 9, 2020
1 parent 9dd5621 commit 88d16ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/media/MediaSettingsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ export default class MediaSettingsModal extends Component {
<Toast notificationType='error' text={`Another ${type === 'image' ? 'image' : 'file'} with the same name exists. Please choose a different name.`}/>,
{className: `${elementStyles.toastError} ${elementStyles.toastLong}`}
);
} else if (err?.response?.status === 413) {
// Error due to file size too large
toast(
<Toast notificationType='error' text={`The ${type === 'image' ? 'image' : 'file'} is too large. Please choose a smaller ${type === 'image' ? 'image' : 'file'}.`}/>,
{className: `${elementStyles.toastError} ${elementStyles.toastLong}`}
);
} else {
toast(
<Toast notificationType='error' text={`There was a problem trying to save this ${type === 'image' ? 'image' : 'file'}. ${DEFAULT_ERROR_TOAST_MSG}`}/>,
Expand Down

0 comments on commit 88d16ff

Please sign in to comment.