mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 12:25:17 +00:00
UBER-391 Unknown error error (#3410)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
d553a261d8
commit
9fb1c64216
@ -52,5 +52,8 @@
|
||||
"UnPinAttachment": "Mark less important",
|
||||
"FilterAttachments": "Attachments",
|
||||
"RemovedAttachment": "Removed attachment"
|
||||
},
|
||||
"status": {
|
||||
"FileTooLarge": "File too large"
|
||||
}
|
||||
}
|
||||
|
@ -52,5 +52,8 @@
|
||||
"UnPinAttachment": "Убрать пометку важное",
|
||||
"FilterAttachments": "Вложения",
|
||||
"RemovedAttachment": "Удалил(а) вложение"
|
||||
},
|
||||
"status": {
|
||||
"FileTooLarge": "Файл слишком большой"
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
//
|
||||
|
||||
import attachment, { attachmentId } from '@hcengineering/attachment'
|
||||
import type { IntlString } from '@hcengineering/platform'
|
||||
import type { IntlString, StatusCode } from '@hcengineering/platform'
|
||||
import { mergeIds } from '@hcengineering/platform'
|
||||
import { ViewAction } from '@hcengineering/view'
|
||||
|
||||
@ -43,6 +43,9 @@ export default mergeIds(attachmentId, attachment, {
|
||||
RemoveAttachmentFromSaved: '' as IntlString,
|
||||
Pinned: '' as IntlString
|
||||
},
|
||||
status: {
|
||||
FileTooLarge: '' as StatusCode
|
||||
},
|
||||
actionImpl: {
|
||||
AddAttachmentToSaved: '' as ViewAction,
|
||||
DeleteAttachmentFromSaved: '' as ViewAction,
|
||||
|
@ -17,7 +17,7 @@
|
||||
import { Attachment } from '@hcengineering/attachment'
|
||||
import { Class, concatLink, Data, Doc, Ref, Space, TxOperations as Client } from '@hcengineering/core'
|
||||
import presentation from '@hcengineering/presentation'
|
||||
import { getMetadata, setPlatformStatus, unknownError } from '@hcengineering/platform'
|
||||
import { PlatformError, Severity, Status, getMetadata, setPlatformStatus, unknownError } from '@hcengineering/platform'
|
||||
|
||||
import attachment from './plugin'
|
||||
|
||||
@ -40,7 +40,11 @@ export async function uploadFile (file: File): Promise<string> {
|
||||
})
|
||||
|
||||
if (resp.status !== 200) {
|
||||
throw Error(`Failed to upload file: ${resp.statusText}`)
|
||||
if (resp.status === 413) {
|
||||
throw new PlatformError(new Status(Severity.ERROR, attachment.status.FileTooLarge, {}))
|
||||
} else {
|
||||
throw Error(`Failed to upload file: ${resp.statusText}`)
|
||||
}
|
||||
}
|
||||
|
||||
return await resp.text()
|
||||
|
Loading…
Reference in New Issue
Block a user