mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 12:55:59 +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",
|
"UnPinAttachment": "Mark less important",
|
||||||
"FilterAttachments": "Attachments",
|
"FilterAttachments": "Attachments",
|
||||||
"RemovedAttachment": "Removed attachment"
|
"RemovedAttachment": "Removed attachment"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"FileTooLarge": "File too large"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,5 +52,8 @@
|
|||||||
"UnPinAttachment": "Убрать пометку важное",
|
"UnPinAttachment": "Убрать пометку важное",
|
||||||
"FilterAttachments": "Вложения",
|
"FilterAttachments": "Вложения",
|
||||||
"RemovedAttachment": "Удалил(а) вложение"
|
"RemovedAttachment": "Удалил(а) вложение"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"FileTooLarge": "Файл слишком большой"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import attachment, { attachmentId } from '@hcengineering/attachment'
|
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 { mergeIds } from '@hcengineering/platform'
|
||||||
import { ViewAction } from '@hcengineering/view'
|
import { ViewAction } from '@hcengineering/view'
|
||||||
|
|
||||||
@ -43,6 +43,9 @@ export default mergeIds(attachmentId, attachment, {
|
|||||||
RemoveAttachmentFromSaved: '' as IntlString,
|
RemoveAttachmentFromSaved: '' as IntlString,
|
||||||
Pinned: '' as IntlString
|
Pinned: '' as IntlString
|
||||||
},
|
},
|
||||||
|
status: {
|
||||||
|
FileTooLarge: '' as StatusCode
|
||||||
|
},
|
||||||
actionImpl: {
|
actionImpl: {
|
||||||
AddAttachmentToSaved: '' as ViewAction,
|
AddAttachmentToSaved: '' as ViewAction,
|
||||||
DeleteAttachmentFromSaved: '' as ViewAction,
|
DeleteAttachmentFromSaved: '' as ViewAction,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import { Attachment } from '@hcengineering/attachment'
|
import { Attachment } from '@hcengineering/attachment'
|
||||||
import { Class, concatLink, Data, Doc, Ref, Space, TxOperations as Client } from '@hcengineering/core'
|
import { Class, concatLink, Data, Doc, Ref, Space, TxOperations as Client } from '@hcengineering/core'
|
||||||
import presentation from '@hcengineering/presentation'
|
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'
|
import attachment from './plugin'
|
||||||
|
|
||||||
@ -40,7 +40,11 @@ export async function uploadFile (file: File): Promise<string> {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (resp.status !== 200) {
|
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()
|
return await resp.text()
|
||||||
|
Loading…
Reference in New Issue
Block a user