Skip to content

Commit

Permalink
fix: Error message for invalid args configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
rogalmic committed Feb 8, 2020
1 parent 2c22844 commit b0c7b38
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ class BashConfigurationProvider implements vscode.DebugConfigurationProvider {
if (!config.type || !config.name) {
let msg = "BUG in Bash Debug: reached to unreachable code.";
msg += "\nIf it is reproducible, please report this bug on: https://github.com/rogalmic/vscode-bash-debug/issues";
msg += "\nYou can avoid this bug by setting \"type\" and \"name\" attributes in launch.json.";
msg += "\nYou can avoid this bug by setting `type` and `name` attributes in launch.json.";
return vscode.window.showErrorMessage(msg).then(_ => { return undefined; });
}
if (!config.request) {
let msg = "Please set \"request\" attribute to \"launch\".";
let msg = "Please set `request` attribute to `launch`.";
return vscode.window.showErrorMessage(msg).then(_ => { return undefined; });
}

Expand All @@ -77,11 +77,17 @@ class BashConfigurationProvider implements vscode.DebugConfigurationProvider {

// Check "required" attributes (defined in package.json) are included
if (!config.program) {
return vscode.window.showErrorMessage("Please specify \"program\" in launch.json.").then(_ => { return undefined; });
return vscode.window.showErrorMessage("Please specify `program` in launch.json.").then(_ => { return undefined; });
}

// Fill non-"required" attributes with default values to prevent bashdb (or other programs) from panic
if (!config.args) { config.args = []; }
if (!config.args) {
config.args = [];
}
else if (!Array.isArray(config.args)) {
return vscode.window.showErrorMessage("Please specify `args` as array of strings in launch.json.").then(_ => { return undefined; });
}

if (!config.env) { config.env = {}; }
if (!config.cwd) {
if (!folder) {
Expand Down

0 comments on commit b0c7b38

Please sign in to comment.