mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 17:22:42 -05:00
* Fix #4029 Ensure changeKernels always resolves, even in error states This is necessary to unblock reverting the kernel on canceling Python install - startSession now correctly sets up kernel information, since a kernel is loaded there. - Remove call to change kernel on session initialize. This isn't needed due to refactor - Handle kernel change failure by attempting to fall back to old kernel - ExtensionHost $startNewSession now ensures errors are sent across the wire. - Update AttachTo and Kernel dropdowns so they handle kernel being available. This is needed since other changes mean the session is likely ready before these get going * Fix to handle python cancel and load existing scenarios - Made changes to handle failure flow when Python dialog is canceled - Made changes to handle initial load fail. Kernel and Attach To dropdowns show No Kernel / None and you can choose a kernel - Added error wrapping in ext host so that string errors make it across and aren't lost.
This commit is contained in:
@@ -81,23 +81,27 @@ export class ExtHostNotebook implements ExtHostNotebookShape {
|
||||
|
||||
$startNewSession(managerHandle: number, options: azdata.nb.ISessionOptions): Thenable<INotebookSessionDetails> {
|
||||
return this._withSessionManager(managerHandle, async (sessionManager) => {
|
||||
let session = await sessionManager.startNew(options);
|
||||
let sessionId = this._addNewAdapter(session);
|
||||
let kernelDetails: INotebookKernelDetails = undefined;
|
||||
if (session.kernel) {
|
||||
kernelDetails = this.saveKernel(session.kernel);
|
||||
try {
|
||||
let session = await sessionManager.startNew(options);
|
||||
let sessionId = this._addNewAdapter(session);
|
||||
let kernelDetails: INotebookKernelDetails = undefined;
|
||||
if (session.kernel) {
|
||||
kernelDetails = this.saveKernel(session.kernel);
|
||||
}
|
||||
let details: INotebookSessionDetails = {
|
||||
sessionId: sessionId,
|
||||
id: session.id,
|
||||
path: session.path,
|
||||
name: session.name,
|
||||
type: session.type,
|
||||
status: session.status,
|
||||
canChangeKernels: session.canChangeKernels,
|
||||
kernelDetails: kernelDetails
|
||||
};
|
||||
return details;
|
||||
} catch (error) {
|
||||
throw typeof(error) === 'string' ? new Error(error) : error;
|
||||
}
|
||||
let details: INotebookSessionDetails = {
|
||||
sessionId: sessionId,
|
||||
id: session.id,
|
||||
path: session.path,
|
||||
name: session.name,
|
||||
type: session.type,
|
||||
status: session.status,
|
||||
canChangeKernels: session.canChangeKernels,
|
||||
kernelDetails: kernelDetails
|
||||
};
|
||||
return details;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -267,7 +271,16 @@ export class ExtHostNotebook implements ExtHostNotebookShape {
|
||||
if (manager === undefined) {
|
||||
return TPromise.wrapError<R>(new Error(localize('errNoManager', 'No Manager found')));
|
||||
}
|
||||
return TPromise.wrap(callback(manager));
|
||||
return TPromise.wrap(this.callbackWithErrorWrap<R>(callback, manager));
|
||||
}
|
||||
|
||||
private async callbackWithErrorWrap<R>(callback: (manager: NotebookManagerAdapter) => R | PromiseLike<R>, manager: NotebookManagerAdapter): Promise<R> {
|
||||
try {
|
||||
let value = await callback(manager);
|
||||
return value;
|
||||
} catch (error) {
|
||||
throw typeof(error) === 'string' ? new Error(error) : error;
|
||||
}
|
||||
}
|
||||
|
||||
private _withServerManager<R>(handle: number, callback: (manager: azdata.nb.ServerManager) => R | PromiseLike<R>): TPromise<R> {
|
||||
|
||||
Reference in New Issue
Block a user