Don't ignore the cancel button

Turns out it returns 'DialogResponses.cancel' instead of undefined
This commit is contained in:
Eric Jizba 2017-12-08 17:20:41 -08:00
Родитель dbf40e41e3
Коммит 046c4054bb
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -57,7 +57,7 @@ async function validateIsFunctionApp(telemetryProperties: { [key: string]: strin
const result: vscode.MessageItem | undefined = await vscode.window.showWarningMessage(message, DialogResponses.yes, DialogResponses.skipForNow, DialogResponses.cancel);
if (result === DialogResponses.yes) {
await createNewProject(telemetryProperties, outputChannel, functionAppPath, false, ui);
} else if (result === undefined) {
} else if (result !== DialogResponses.skipForNow) {
throw new UserCancelledError();
}
}

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

@ -36,10 +36,12 @@ export async function copyFolder(fromPath: string, toPath: string): Promise<void
export async function confirmOverwriteFile(fsPath: string): Promise<boolean> {
if (await fse.pathExists(fsPath)) {
const result: MessageItem | undefined = await vscode.window.showWarningMessage(localize('azFunc.fileAlreadyExists', 'File "{0}" already exists. Overwrite?', fsPath), DialogResponses.yes, DialogResponses.no, DialogResponses.cancel);
if (result === undefined) {
throw new UserCancelledError();
if (result === DialogResponses.yes) {
return true;
} else if (result === DialogResponses.no) {
return false;
} else {
return result === DialogResponses.yes;
throw new UserCancelledError();
}
} else {
return true;