diff --git a/lang/default.json b/lang/default.json index bb9cc620f5..b88d7e237c 100644 --- a/lang/default.json +++ b/lang/default.json @@ -97,6 +97,9 @@ "defaultMessage": "Last 1 month", "description": "src/views/Me/Analytics/SelectPeriod/index.tsx" }, + "/BZiQv": { + "defaultMessage": "Upload Failed" + }, "/GCoTA": { "defaultMessage": "Clear" }, @@ -2205,6 +2208,9 @@ "WFCO2w": { "defaultMessage": "Set Collection" }, + "WHd6DD": { + "defaultMessage": "Too Frequent" + }, "WIOxG+": { "defaultMessage": "Collapse", "description": "src/components/CircleComment/DropdownActions/CollapseComment/Button.tsx" diff --git a/lang/en.json b/lang/en.json index e635107fc2..47c94e6613 100644 --- a/lang/en.json +++ b/lang/en.json @@ -97,6 +97,9 @@ "defaultMessage": "Last 1 month", "description": "src/views/Me/Analytics/SelectPeriod/index.tsx" }, + "/BZiQv": { + "defaultMessage": "Upload Failed" + }, "/GCoTA": { "defaultMessage": "Clear" }, @@ -2205,6 +2208,9 @@ "WFCO2w": { "defaultMessage": "Set Collection" }, + "WHd6DD": { + "defaultMessage": "Too Frequent" + }, "WIOxG+": { "defaultMessage": "Collapse", "description": "src/components/CircleComment/DropdownActions/CollapseComment/Button.tsx" diff --git a/lang/zh-Hans.json b/lang/zh-Hans.json index dd68bb4de9..6ee7312e89 100644 --- a/lang/zh-Hans.json +++ b/lang/zh-Hans.json @@ -97,6 +97,9 @@ "defaultMessage": "最近 1 个月", "description": "src/views/Me/Analytics/SelectPeriod/index.tsx" }, + "/BZiQv": { + "defaultMessage": "Upload Failed" + }, "/GCoTA": { "defaultMessage": "清空" }, @@ -2205,6 +2208,9 @@ "WFCO2w": { "defaultMessage": "关联作品" }, + "WHd6DD": { + "defaultMessage": "Too Frequent" + }, "WIOxG+": { "defaultMessage": "取消折叠", "description": "src/components/CircleComment/DropdownActions/CollapseComment/Button.tsx" diff --git a/lang/zh-Hant.json b/lang/zh-Hant.json index c672ccf992..85f1e7c6b7 100644 --- a/lang/zh-Hant.json +++ b/lang/zh-Hant.json @@ -97,6 +97,9 @@ "defaultMessage": "最近 1 個月", "description": "src/views/Me/Analytics/SelectPeriod/index.tsx" }, + "/BZiQv": { + "defaultMessage": "Upload Failed" + }, "/GCoTA": { "defaultMessage": "清空" }, @@ -2205,6 +2208,9 @@ "WFCO2w": { "defaultMessage": "關聯作品" }, + "WHd6DD": { + "defaultMessage": "Too Frequent" + }, "WIOxG+": { "defaultMessage": "闔上", "description": "src/components/CircleComment/DropdownActions/CollapseComment/Button.tsx" diff --git a/src/components/FileUploader/MomentAssetsUploader/Item.tsx b/src/components/FileUploader/MomentAssetsUploader/Item.tsx index 8edcbdd1f4..c7cd1423bf 100644 --- a/src/components/FileUploader/MomentAssetsUploader/Item.tsx +++ b/src/components/FileUploader/MomentAssetsUploader/Item.tsx @@ -1,12 +1,15 @@ +import { ApolloError } from '@apollo/client' import _omit from 'lodash/omit' import { memo, useContext, useEffect, useState } from 'react' import { FormattedMessage } from 'react-intl' import IconCircleTimesFill from '@/public/static/icons/24px/circle-times-fill.svg' import IconWarn from '@/public/static/icons/24px/warn.svg' +import { ERROR_CODES } from '~/common/enums' import { ASSET_TYPE, ENTITY_TYPE } from '~/common/enums/file' import { validateImage } from '~/common/utils' import { useDirectImageUpload, useMutation, ViewerContext } from '~/components' +import { getErrorCodes } from '~/components/GQL' import { DIRECT_IMAGE_UPLOAD, DIRECT_IMAGE_UPLOAD_DONE, @@ -33,6 +36,20 @@ type UploadedAsset = { path: string } +const UploadErrorMessage = ({ error }: { error?: Error }) => { + const [code] = getErrorCodes(error as ApolloError) + + if (code === ERROR_CODES.ACTION_LIMIT_EXCEEDED) { + return + } + + if (error) { + return + } + + return +} + export const Item = memo(function Item({ asset, removeAsset, @@ -115,7 +132,13 @@ export const Item = memo(function Item({ draft: false, url: path, }, - }).catch(console.error) + }).catch((error) => { + console.error('[MomentAssetsUploader] direct upload done failed', { + error, + assetId, + path, + }) + }) setUploadedAsset({ assetId, path }) } else { @@ -151,7 +174,7 @@ export const Item = memo(function Item({
- +
)}