Electron FS performance improvements & fixes

This commit is contained in:
Alex Gleason committed 2025-10-30 00:28:55 -05:00
1 parent 1f1380cc28
commit f5d1c31b3b
4 files changed
+194 -20

No files matched your search

+10
View File
@@ -190,6 +190,7 @@ ipcMain.handle('fs:readFile', async (event, filePath, encoding) => {
if (!filePath) {
const err = new Error('Failed to read file: path is required');
err.code = 'EINVAL';
// Don't log - empty paths are expected from isomorphic-git's ref resolution
throw err;
}
try {
@@ -210,6 +211,11 @@ ipcMain.handle('fs:readFile', async (event, filePath, encoding) => {
configurable: true,
});
}
// Don't log ENOENT errors - these are expected for git packed objects and missing refs
// Only log unexpected errors
if (error.code !== 'ENOENT' && error.code !== 'EINVAL') {
console.error(err);
}
throw err;
}
});
@@ -267,6 +273,10 @@ ipcMain.handle('fs:readdir', async (event, dirPath, withFileTypes) => {
configurable: true,
});
}
// Only log non-ENOTDIR errors (ENOTDIR is expected when checking if a file is a directory)
if (error.code !== 'ENOTDIR') {
console.error(err);
}
throw err;
}
});