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.
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.
| 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.
| 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.
| 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.
|
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.