From 174f580006a057083e8d2ccd25d7b1d24e452ab3 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 3 Jun 2021 14:56:27 +0100 Subject: [PATCH] return reject and resolve --- apps/remix-ide/src/app/panels/file-panel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 8d4ec5602f..e8e3617ce8 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -168,21 +168,21 @@ module.exports = class Filepanel extends ViewPlugin { // insert example contracts if there are no files to show return new Promise((resolve, reject) => { this._deps.fileProviders.browser.resolveDirectory('/', async (error, filesList) => { - if (error) console.error(error) + if (error) return reject(error) if (Object.keys(filesList).length === 0) { await this.createWorkspace('default_workspace') resolve('default_workspace') } else { this._deps.fileProviders.browser.resolveDirectory('.workspaces', async (error, filesList) => { - if (error) console.error(error) + if (error) return reject(error) if (Object.keys(filesList).length > 0) { const workspacePath = Object.keys(filesList)[0].split('/').filter(val => val) const workspaceName = workspacePath[workspacePath.length - 1] this._deps.fileProviders.workspace.setWorkspace(workspaceName) - resolve(workspaceName) + return resolve(workspaceName) } - reject(new Error('Can\'t find available workspace.')) + return reject(new Error('Can\'t find available workspace.')) }) } })