Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw proper error when nightwatch config file not found. #41

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/extensionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead we can show the popup window to show the error with the path

throw new Error(`Error while trying to require Nightwatch config file from "${res[0].path}": ${err}`)
}
});

nightwatchExt.startSession();
Expand Down
Loading