From c8c80d8c1d98a9285f40b3ed66b566bc56ee2844 Mon Sep 17 00:00:00 2001 From: Priyansh Garg Date: Thu, 15 Feb 2024 23:52:58 +0530 Subject: [PATCH] Throw proper error when nightwatch config file not found. --- src/extensionManager.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/extensionManager.ts b/src/extensionManager.ts index 251c16a..fd6d541 100644 --- a/src/extensionManager.ts +++ b/src/extensionManager.ts @@ -63,9 +63,13 @@ export class ExtensionManager { delete __non_webpack_require__.cache[ __non_webpack_require__.resolve(res[0].path) ]; - const nwConfig = require(/* webpackIgnore: true */ res[0].path); - const workspaceState = this.context.workspaceState; - workspaceState.update('nwConfig', nwConfig); + try { + const nwConfig = require(/* webpackIgnore: true */ res[0].path); + const workspaceState = this.context.workspaceState; + workspaceState.update('nwConfig', nwConfig); + } catch (err) { + throw new Error(`Error while trying to require Nightwatch config file from "${res[0].path}": ${err}`) + } }); nightwatchExt.startSession();