diff --git a/src/vs/workbench/api/browser/mainThreadDebugService.ts b/src/vs/workbench/api/browser/mainThreadDebugService.ts index 649157c0cfe..ca2dcb4998c 100644 --- a/src/vs/workbench/api/browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/browser/mainThreadDebugService.ts @@ -219,7 +219,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb return undefined; } - public $startDebugging(folder: UriComponents | undefined, nameOrConfig: string | IDebugConfiguration, options: IStartDebuggingOptions): Promise { + public async $startDebugging(folder: UriComponents | undefined, nameOrConfig: string | IDebugConfiguration, options: IStartDebuggingOptions): Promise { const folderUri = folder ? uri.revive(folder) : undefined; const launch = this.debugService.getConfigurationManager().getLaunch(folderUri); const parentSession = this.getSession(options.parentSessionID); @@ -232,11 +232,11 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb debugUI: options.debugUI, compoundRoot: parentSession?.compoundRoot }; - return this.debugService.startDebugging(launch, nameOrConfig, debugOptions, !options.suppressSaveBeforeStart).then(success => { - return success; - }, err => { - return Promise.reject(new Error(err && err.message ? err.message : 'cannot start debugging')); - }); + try { + return this.debugService.startDebugging(launch, nameOrConfig, debugOptions, !options.suppressSaveBeforeStart); + } catch (err) { + throw new Error(err && err.message ? err.message : 'cannot start debugging'); + } } public $setDebugSessionName(sessionId: DebugSessionUUID, name: string): void {