Improve archive error display

pull/62/head
Varun Patil 2022-09-25 16:09:08 -07:00
parent dc2615e107
commit 64d313c858
2 changed files with 8 additions and 3 deletions

View File

@ -1135,7 +1135,11 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
try { try {
this.loading++; this.loading++;
for await (const delIds of dav.archiveFilesByIds(Array.from(this.selection.keys()), !this.routeIsArchive())) { for await (let delIds of dav.archiveFilesByIds(Array.from(this.selection.keys()), !this.routeIsArchive())) {
delIds = delIds.filter(x => x);
if (delIds.length === 0) {
continue
}
const delPhotos = delIds.map(id => this.selection.get(id)); const delPhotos = delIds.map(id => this.selection.get(id));
await this.deleteFromViewWithAnimation(delPhotos); await this.deleteFromViewWithAnimation(delPhotos);
} }

View File

@ -245,8 +245,9 @@ export async function archiveFile(fileid: number, archive: boolean) {
await archiveFile(id, archive); await archiveFile(id, archive);
return id as number; return id as number;
} catch (error) { } catch (error) {
console.error('Failed to archive', id, error); console.error('Failed to (un)archive', id, error);
showError(t('memories', 'Failed to archive some files.')); const msg = error?.response?.data?.message || t('memories', 'General Failure');
showError(t('memories', 'Error: {msg}', { msg }));
return 0; return 0;
} }
}); });