removed try catch from clone collection

This commit is contained in:
Akshat Khosya 2023-12-16 13:16:03 +05:30
parent 93661bd0d2
commit cada4f201a

View File

@ -42,6 +42,7 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
ipcMain.handle( ipcMain.handle(
'renderer:create-collection', 'renderer:create-collection',
async (event, collectionName, collectionFolderName, collectionLocation) => { async (event, collectionName, collectionFolderName, collectionLocation) => {
try {
const dirPath = path.join(collectionLocation, collectionFolderName); const dirPath = path.join(collectionLocation, collectionFolderName);
if (fs.existsSync(dirPath)) { if (fs.existsSync(dirPath)) {
throw new Error(`collection: ${dirPath} already exists`); throw new Error(`collection: ${dirPath} already exists`);
@ -64,13 +65,15 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
mainWindow.webContents.send('main:collection-opened', dirPath, uid, brunoConfig); mainWindow.webContents.send('main:collection-opened', dirPath, uid, brunoConfig);
ipcMain.emit('main:collection-opened', mainWindow, dirPath, uid); ipcMain.emit('main:collection-opened', mainWindow, dirPath, uid);
} catch (error) {
return Promise.reject(error);
}
} }
); );
// clone collection // clone collection
ipcMain.handle( ipcMain.handle(
'renderer:clone-collection', 'renderer:clone-collection',
async (event, collectionName, collectionFolderName, collectionLocation, previousPath) => { async (event, collectionName, collectionFolderName, collectionLocation, previousPath) => {
try {
const dirPath = path.join(collectionLocation, collectionFolderName); const dirPath = path.join(collectionLocation, collectionFolderName);
if (fs.existsSync(dirPath)) { if (fs.existsSync(dirPath)) {
throw new Error(`collection: ${dirPath} already exists`); throw new Error(`collection: ${dirPath} already exists`);
@ -111,9 +114,6 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
mainWindow.webContents.send('main:collection-opened', dirPath, uid, json); mainWindow.webContents.send('main:collection-opened', dirPath, uid, json);
ipcMain.emit('main:collection-opened', mainWindow, dirPath, uid); ipcMain.emit('main:collection-opened', mainWindow, dirPath, uid);
} catch (error) {
return Promise.reject(error);
}
} }
); );
// rename collection // rename collection