-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Modified the errors produced by debugLauncher.js when launch.json is not configured right #14739
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
Modified the errors produced by debugLauncher.js when launch.json is not configured right #14739
Conversation
karrtikr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Don't forget to thank yourself in news entry as mentioned in the PR template🙂
| traceError('could not get debug config', exc); | ||
| const appShell = this.serviceContainer.get<IApplicationShell>(IApplicationShell); | ||
| await appShell.showErrorMessage('Could not load unit test config from launch.json'); | ||
| await appShell.showErrorMessage('Could not load unit test config from launch.json; missing a field'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await appShell.showErrorMessage('Could not load unit test config from launch.json; missing a field'); | |
| await appShell.showErrorMessage('Could not load unit test config from launch.json as it is missing a field'); |
| if (!Array.isArray(parsed.configurations)) { | ||
| throw Error('malformed launch.json'); | ||
| } | ||
| if (!parsed.configurations) { | ||
| throw Error('Missing field in launch.json: configurations'); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (!Array.isArray(parsed.configurations)) { | |
| throw Error('malformed launch.json'); | |
| } | |
| if (!parsed.configurations) { | |
| throw Error('Missing field in launch.json: configurations'); | |
| } | |
| if (!parsed.configurations || !Array.isArray(parsed.configurations)) { | |
| throw Error('Missing field in launch.json: configurations'); | |
| } |
news/14739.md
Outdated
| @@ -0,0 +1,2 @@ | |||
| Modified the errors generated by debugLauncher.ts to be more specific when launch.json is not properly configured | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Modified the errors generated by debugLauncher.ts to be more specific when launch.json is not properly configured | |
| Modified the errors generated when `launch.json` is not properly configured to be more specific about which fields are missing. |
Making the message user friendly as users have no idea about debugLauncher.ts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to put the news entry under news\3 Code Health. Other than that LGTM.
|
I think everything should be good now, let me know if I can make something otherwise better. |
|
The news entry text was not changed as I suggested. |
|
Kudos, SonarCloud Quality Gate passed!
|
Sorry, I think I missed that last night. Fixed it now! |
|
@karrtikr Thank you for guiding me through this issue, it was a very positive and fun experience. I look forward to contributing more in the coming weeks. |
For #14381
debugLauncher.js throws a general and misleading error when it detects something wrong with launch.json file, this PR aims to fix that by tackling each case independently so that the correct error is produced and the user knows exactly what to fix.
Has sufficient logging.Has telemetry for enhancements.Unit tests & system/integration tests are added/updated.Test plan is updated as appropriate.package-lock.jsonhas been regenerated by runningnpm install(if dependencies have changed).The wiki is updated with any design decisions/details.