Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: handle error when removing an attachment

thecodrrf83933381ba5
diff --git a/apps/web/src/common/multi-select.ts b/apps/web/src/common/multi-select.ts
index e737064d5..efb769d91 100644
--- a/apps/web/src/common/multi-select.ts
+++ b/apps/web/src/common/multi-select.ts
@@ -103,7 +103,6 @@ async function deleteAttachments(attachments: any[]) {
current: i,
total: attachments.length,
});
- console.log(attachment);
await attachmentStore.permanentDelete(attachment.metadata.hash);
}
},
diff --git a/apps/web/src/stores/attachment-store.js b/apps/web/src/stores/attachment-store.js
index 75aba5113..0998a84fd 100644
--- a/apps/web/src/stores/attachment-store.js
+++ b/apps/web/src/stores/attachment-store.js
@@ -4,6 +4,7 @@ import BaseStore from "./index";
import { AppEventManager, AppEvents } from "../common/app-events";
import { store as editorStore } from "./editor-store";
import { checkAttachment } from "../common/attachments";
+import { showToast } from "../utils/toast";
class AttachmentStore extends BaseStore {
attachments = [];
@@ -55,11 +56,8 @@ class AttachmentStore extends BaseStore {
this._changeWorkingStatus(index, false, success ? null : failed);
} catch (e) {
console.error(e);
- this._changeWorkingStatus(
- index,
- false,
- `Rechecking failed: ${e.message}`
- );
+ this._changeWorkingStatus(index, false, false);
+ showToast("error", `Rechecking failed: ${e.message}`);
}
}
};
@@ -90,7 +88,9 @@ class AttachmentStore extends BaseStore {
}
} catch (e) {
console.error(e);
- this._changeWorkingStatus(index, false, `Failed to delete: ${e.message}`);
+ this._changeWorkingStatus(index, false, false);
+ showToast("error", `Failed to delete: ${e.message}`);
+ throw e;
}
};