Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Fix error logging and check for deleted files
Hakan Shehuaa2807841aa4
diff --git a/apps/desktop/src/main/bootstrapper.ts b/apps/desktop/src/main/bootstrapper.tsindex d7565fc5..40780909 100644--- a/apps/desktop/src/main/bootstrapper.ts+++ b/apps/desktop/src/main/bootstrapper.ts@@ -55,7 +55,7 @@ class Bootstrapper {notificationService.checkBadge();} catch (error) {- this.logger.error('Error executing event loop', error);+ this.logger.error(error, 'Error executing event loop');}this.eventLoop = setTimeout(this.executeEventLoop, EVENT_LOOP_INTERVAL);diff --git a/apps/desktop/src/main/services/file-service.ts b/apps/desktop/src/main/services/file-service.tsindex d554a178..82db2f03 100644--- a/apps/desktop/src/main/services/file-service.ts+++ b/apps/desktop/src/main/services/file-service.ts@@ -176,7 +176,7 @@ class FileService {try {await this.uploadWorkspaceFiles(userId);} catch (error) {- this.logger.error(`Error uploading files for user ${userId}`, error);+ this.logger.error(error, `Error uploading files for user ${userId}`);} finally {fileState.isUploading = false;if (fileState.isUploadScheduled) {@@ -209,7 +209,7 @@ class FileService {try {await this.downloadWorkspaceFiles(userId);} catch (error) {- this.logger.error(`Error downloading files for user ${userId}`, error);+ this.logger.error(error, `Error downloading files for user ${userId}`);} finally {fileState.isDownloading = false;if (fileState.isDownloadScheduled) {@@ -513,7 +513,12 @@ class FileService {const workspaceDatabase =await databaseService.getWorkspaceDatabase(userId);- const files = fs.readdirSync(getWorkspaceFilesDirectoryPath(userId));+ const filesDir = getWorkspaceFilesDirectoryPath(userId);+ if (!fs.existsSync(filesDir)) {+ return;+ }++ const files = fs.readdirSync(filesDir);while (files.length > 0) {const batch = files.splice(0, 100);const fileIdMap: Record<string, string> = {};