throw error from downloadFile util

This commit is contained in:
Abhinav 2023-08-25 11:57:50 +05:30
parent ba78b74e70
commit 0be74faecd
3 changed files with 21 additions and 12 deletions

View file

@ -514,12 +514,16 @@ function PhotoViewer(props: Iprops) {
const downloadFileHelper = async (file) => {
if (file && props.enableDownload) {
appContext.startLoading();
await downloadFile(
file,
publicCollectionGalleryContext.accessedThroughSharedURL,
publicCollectionGalleryContext.token,
publicCollectionGalleryContext.passwordToken
);
try {
await downloadFile(
file,
publicCollectionGalleryContext.accessedThroughSharedURL,
publicCollectionGalleryContext.token,
publicCollectionGalleryContext.passwordToken
);
} catch (e) {
// do nothing
}
appContext.finishLoading();
}
};

View file

@ -206,12 +206,16 @@ export default function PublicCollectionGallery() {
}
appContext.startLoading();
for (const file of publicFiles) {
await downloadFile(
file,
true,
token.current,
passwordJWTToken.current
);
try {
await downloadFile(
file,
true,
token.current,
passwordJWTToken.current
);
} catch (e) {
// do nothing
}
}
appContext.finishLoading();
};

View file

@ -142,6 +142,7 @@ export async function downloadFile(
}
} catch (e) {
logError(e, 'failed to download file');
throw e;
}
}