fix: download success toast showing up even if download errors (#1018)

This commit is contained in:
Aman Harwara
2022-05-09 23:07:02 +05:30
committed by GitHub
parent f35a454614
commit 9e370df2e8

View File

@@ -34,7 +34,7 @@ export class FilesState {
const decryptedBytesArray: Uint8Array[] = [] const decryptedBytesArray: Uint8Array[] = []
await this.application.files.downloadFile(file, async (decryptedBytes, progress) => { const result = await this.application.files.downloadFile(file, async (decryptedBytes, progress) => {
if (isUsingStreamingSaver) { if (isUsingStreamingSaver) {
await saver.pushBytes(decryptedBytes) await saver.pushBytes(decryptedBytes)
} else { } else {
@@ -51,6 +51,10 @@ export class FilesState {
} }
}) })
if (result instanceof ClientDisplayableError) {
throw new Error(result.text)
}
if (isUsingStreamingSaver) { if (isUsingStreamingSaver) {
await saver.finish() await saver.finish()
} else { } else {