Handle error case when no command found

Fix for #25
This commit is contained in:
Eric Jizba 2017-08-02 09:27:42 -07:00
Родитель c4d921e974
Коммит 9347d7fb51
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -22,8 +22,13 @@ export class MongoCommands {
}
const selection = activeEditor.selection;
const command = MongoCommands.getCommand(activeEditor.document.getText(), selection.start);
MongoCommands.executeCommand(command, database)
.then(result => this.showResult(result, activeEditor.viewColumn + 1));
if (command) {
MongoCommands.executeCommand(command, database)
.then(result => this.showResult(result, activeEditor.viewColumn + 1));
} else {
vscode.window.showErrorMessage('No executable command found.');
}
return command;
}