Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (JSONExt.deepEqual(update, cluster)) {
// If the user canceled, or the model is identical don't try to update.
return Promise.resolve(cluster);
}
const response = await ServerConnection.makeRequest(
`${this._serverSettings.baseUrl}dask/clusters/${id}`,
{
method: 'PATCH',
body: JSON.stringify(update)
},
this._serverSettings
);
if (response.status !== 200) {
const err = await response.json();
void showErrorMessage('Failed to scale cluster', err);
throw err;
}
const model = (await response.json()) as IClusterModel;
await this._updateClusterList();
return model;
}
.catch(reason => {
// Dispose the document if rendering fails.
requestAnimationFrame(() => {
this.dispose();
});
void showErrorMessage(
`Renderer Failure: ${this._context.path}`,
reason
);
});
}
try {
// Do the rendering asynchronously.
this._isRendering = true;
await this.renderer.renderModel(mimeModel);
this._isRendering = false;
// If there is an outstanding request to render, go ahead and render
if (this._renderRequested) {
return this._render();
}
} catch (reason) {
// Dispose the document if rendering fails.
requestAnimationFrame(() => {
this.dispose();
});
void showErrorMessage(`Renderer Failure: ${context.path}`, reason);
}
}
.catch(reason => {
console.error(reason);
showErrorMessage(
"Fail to read settings for '@hadim/jupyter-archive:archive'",
reason
);
});
Promise.all(pending).catch(error => {
showErrorMessage('Upload Error', error);
});
};
return {
value: training.id,
text: training.id
};
}),
'Remove training',
true
)
.then(({ value }) =>
commands.execute(CommandIDs.removeCloudTraining, {
name: value.value
})
);
}
} catch (err) {
showErrorMessage('Can not remove cloud training', err);
}
}
});
);
} else {
dialogs
.showLogoutDialog(
options.state.credentials
? options.state.credentials.cluster
: 'Internal cluster'
)
.then(({ button }) => {
if (button.accept) {
options.state.setCredentials();
}
});
}
} catch (err) {
showErrorMessage('Can not reset cluster authorization', err);
}
}
});
Promise.all(promises).catch(error => {
showErrorMessage('Error while copying/moving files', error);
});
}
.catch(err => {
launcher.pending = false;
void showErrorMessage('Launcher Error', err);
});
};
.catch(error => showErrorMessage(errorTitle, error));
},