From cceaf143236f352fc0eb429b5084aaf74545c323 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Wed, 9 Sep 2020 15:37:10 -0700 Subject: [PATCH] #106358 --- src/vs/base/node/ps.ts | 11 ++++++++++- .../authentication/browser/authenticationService.ts | 7 ++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/vs/base/node/ps.ts b/src/vs/base/node/ps.ts index 0786b753dd242..31223d4a5d81c 100644 --- a/src/vs/base/node/ps.ts +++ b/src/vs/base/node/ps.ts @@ -193,6 +193,11 @@ export function listProcesses(rootPid: number): Promise { processInfo.load = parseFloat(cpuUsage[i]); } + if (!rootItem) { + reject(new Error(`Root process ${rootPid} not found`)); + return; + } + resolve(rootItem); } }); @@ -228,7 +233,11 @@ export function listProcesses(rootPid: number): Promise { if (process.platform === 'linux') { calculateLinuxCpuUsage(); } else { - resolve(rootItem); + if (!rootItem) { + reject(new Error(`Root process ${rootPid} not found`)); + } else { + resolve(rootItem); + } } } }); diff --git a/src/vs/workbench/services/authentication/browser/authenticationService.ts b/src/vs/workbench/services/authentication/browser/authenticationService.ts index 7d058a717aaaa..db85f09a426ea 100644 --- a/src/vs/workbench/services/authentication/browser/authenticationService.ts +++ b/src/vs/workbench/services/authentication/browser/authenticationService.ts @@ -444,7 +444,12 @@ export class AuthenticationService extends Disposable implements IAuthentication const didRegister: Promise = new Promise((resolve, _) => { this.onDidRegisterAuthenticationProvider(e => { if (e.id === providerId) { - resolve(this._authenticationProviders.get(providerId)); + provider = this._authenticationProviders.get(providerId); + if (provider) { + resolve(provider); + } else { + throw new Error(`No authentication provider '${providerId}' is currently registered.`); + } } }); });