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(
'renderer:create-collection',
async (event, collectionName, collectionFolderName, collectionLocation) => {
try {
const dirPath = path.join(collectionLocation, collectionFolderName);
if (fs.existsSync(dirPath)) {
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);
ipcMain.emit('main:collection-opened', mainWindow, dirPath, uid);
} catch (error) {
return Promise.reject(error);
}
}
);
// clone collection
ipcMain.handle(
'renderer:clone-collection',
async (event, collectionName, collectionFolderName, collectionLocation, previousPath) => {
try {
const dirPath = path.join(collectionLocation, collectionFolderName);
if (fs.existsSync(dirPath)) {
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);
ipcMain.emit('main:collection-opened', mainWindow, dirPath, uid);
} catch (error) {
return Promise.reject(error);
}
}
);
// rename collection