Skip to content

Commit 96f1b19

Browse files
authored
Don't show error response HTML in notification when uploaded file is … (codesandbox#3425)
* Don't show error response HTML in notification when uploaded file is too large. * Refactor as per review.
1 parent 0433ae8 commit 96f1b19

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/app/src/app/overmind/internalActions.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,18 @@ export const handleError: Action<{
390390
*/
391391
message: string;
392392
error: ApiError | Error;
393-
}> = ({ actions, effects }, { message, error }) => {
393+
hideErrorMessage?: boolean;
394+
}> = ({ actions, effects }, { message, error, hideErrorMessage = false }) => {
395+
if (hideErrorMessage) {
396+
effects.analytics.logError(error);
397+
effects.notificationToast.add({
398+
message,
399+
status: NotificationStatus.ERROR,
400+
});
401+
402+
return;
403+
}
404+
394405
const isGenericError =
395406
!('response' in error) ||
396407
error.response == null ||

packages/app/src/app/overmind/namespaces/files/actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ export const filesUploaded: AsyncAction<{
441441
actions.internal.handleError({
442442
message: `The uploaded file is bigger than 7MB, contact [email protected] if you want to raise this limit`,
443443
error,
444+
hideErrorMessage: true,
444445
});
445446
} else {
446447
actions.internal.handleError({

0 commit comments

Comments
 (0)