Skip to content

Commit

Permalink
Handle explicit state for poller. (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsinnit authored Oct 9, 2023
1 parent 2505ee7 commit 0198f96
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/panels/CreateClusterPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ async function createCluster(
const poller = await containerServiceClient.managedClusters.beginCreateOrUpdate(group.name, name, clusterSpec);

poller.onProgress(state => {
if (state.isCancelled) {
if (state.status === "canceled") {
webview.postMessage({
command: "progressUpdate",
parameters: {
Expand All @@ -159,17 +159,18 @@ async function createCluster(
errorMessage: null
}
});
} else if (state.error) {
window.showErrorMessage(`Error creating AKS cluster ${name}: ${getErrorMessage(state.error)}`);
} else if (state.status === "failed") {
const errorMessage = state.error ? getErrorMessage(state.error) : "Unknown error";
window.showErrorMessage(`Error creating AKS cluster ${name}: ${errorMessage}`);
webview.postMessage({
command: "progressUpdate",
parameters: {
event: ProgressEventType.Failed,
operationDescription,
errorMessage: getErrorMessage(state.error)
errorMessage
}
});
} else if (state.isCompleted) {
} else if (state.status === "succeeded") {
window.showInformationMessage(`Successfully created AKS cluster ${name}.`);
webview.postMessage({
command: "progressUpdate",
Expand Down

0 comments on commit 0198f96

Please sign in to comment.