mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-21 04:08:01 +02:00
removed try catch from clone collection
This commit is contained in:
parent
93661bd0d2
commit
cada4f201a
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user