From 9b54fd4f9fea0e9c33cbb1461b161a65a333be68 Mon Sep 17 00:00:00 2001 From: Tyler Nieman Date: Thu, 12 Sep 2024 09:21:40 -0700 Subject: [PATCH] :recycle: isolate fs.write in try-catch --- src/main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 521a016..4a7df34 100644 --- a/src/main.ts +++ b/src/main.ts @@ -365,8 +365,6 @@ export default class ReadwisePlugin extends Plugin { contentToSave = existingContent + contents; } await this.fs.write(originalName, contentToSave); - await this.removeBooksFromRefresh([bookID]); - await this.removeBookFromFailedBooks([bookID]); } catch (e) { console.log(`Readwise Official plugin: error writing ${processedFileName}:`, e); this.notice(`Readwise: error while writing ${processedFileName}: ${e}`, true, 4, true); @@ -376,6 +374,9 @@ export default class ReadwisePlugin extends Plugin { } // communicate with readwise? } + + await this.removeBooksFromRefresh([bookID]); + await this.removeBookFromFailedBooks([bookID]); } await this.saveSettings(); }