From 2d27d4d079ac66e3626cb82e56d0e948d8299b7e Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 14 Jul 2020 11:32:28 +0200 Subject: [PATCH] use NotSupportedError for symbols that require the ability to launch processes, https://github.com/microsoft/vscode/issues/101857 --- src/vs/base/common/errors.ts | 9 +++++++++ src/vs/workbench/api/common/extHostTask.ts | 4 ++-- .../workbench/api/common/extHostTerminalService.ts | 14 +++++++------- .../browser/webWorkerFileSystemProvider.ts | 12 ++++++------ 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/vs/base/common/errors.ts b/src/vs/base/common/errors.ts index b2440204634..f6d4f5cf893 100644 --- a/src/vs/base/common/errors.ts +++ b/src/vs/base/common/errors.ts @@ -203,3 +203,12 @@ export class NotImplementedError extends Error { } } } + +export class NotSupportedError extends Error { + constructor(message?: string) { + super('NotSupported'); + if (message) { + this.message = message; + } + } +} diff --git a/src/vs/workbench/api/common/extHostTask.ts b/src/vs/workbench/api/common/extHostTask.ts index 05d67b09eab..066e6ddb489 100644 --- a/src/vs/workbench/api/common/extHostTask.ts +++ b/src/vs/workbench/api/common/extHostTask.ts @@ -26,7 +26,7 @@ import * as Platform from 'vs/base/common/platform'; import { ILogService } from 'vs/platform/log/common/log'; import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService'; import { USER_TASKS_GROUP_KEY } from 'vs/workbench/contrib/tasks/common/taskService'; -import { NotImplementedError } from 'vs/base/common/errors'; +import { NotSupportedError } from 'vs/base/common/errors'; export interface IExtHostTask extends ExtHostTaskShape { @@ -717,7 +717,7 @@ export class WorkerExtHostTask extends ExtHostTaskBase { if (CustomExecutionDTO.is(dto.execution)) { await this.addCustomExecution(dto, task, false); } else { - throw new NotImplementedError(); + throw new NotSupportedError(); } // Always get the task execution first to prevent timing issues when retrieving it later diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index 0c7fd876a8d..fa0153a25a6 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -18,7 +18,7 @@ import { Disposable as VSCodeDisposable, EnvironmentVariableMutatorType } from ' import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { ISerializableEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariable'; import { localize } from 'vs/nls'; -import { NotImplementedError } from 'vs/base/common/errors'; +import { NotSupportedError } from 'vs/base/common/errors'; import { serializeEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariableShared'; export interface IExtHostTerminalService extends ExtHostTerminalServiceShape { @@ -819,11 +819,11 @@ export class EnvironmentVariableCollection implements vscode.EnvironmentVariable export class WorkerExtHostTerminalService extends BaseExtHostTerminalService { public createTerminal(name?: string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal { - throw new NotImplementedError(); + throw new NotSupportedError(); } public createTerminalFromOptions(options: vscode.TerminalOptions): vscode.Terminal { - throw new NotImplementedError(); + throw new NotSupportedError(); } public getDefaultShell(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string { @@ -832,19 +832,19 @@ export class WorkerExtHostTerminalService extends BaseExtHostTerminalService { } public getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string { - throw new NotImplementedError(); + throw new NotSupportedError(); } public $spawnExtHostProcess(id: number, shellLaunchConfigDto: IShellLaunchConfigDto, activeWorkspaceRootUriComponents: UriComponents, cols: number, rows: number, isWorkspaceShellAllowed: boolean): Promise { - throw new NotImplementedError(); + throw new NotSupportedError(); } public $getAvailableShells(): Promise { - throw new NotImplementedError(); + throw new NotSupportedError(); } public async $getDefaultShellAndArgs(useAutomationShell: boolean): Promise { - throw new NotImplementedError(); + throw new NotSupportedError(); } public $acceptWorkspacePermissionsChanged(isAllowed: boolean): void { diff --git a/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.ts b/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.ts index c0e53c971a5..ee6f058e4b4 100644 --- a/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.ts +++ b/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.ts @@ -7,7 +7,7 @@ import { FileSystemProviderCapabilities, IStat, FileType, FileDeleteOptions, Fil import { Event } from 'vs/base/common/event'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; -import { NotImplementedError } from 'vs/base/common/errors'; +import { NotSupportedError } from 'vs/base/common/errors'; export class FetchFileSystemProvider implements IFileSystemProviderWithFileReadWriteCapability { @@ -44,18 +44,18 @@ export class FetchFileSystemProvider implements IFileSystemProviderWithFileReadW // error implementations writeFile(_resource: URI, _content: Uint8Array, _opts: FileWriteOptions): Promise { - throw new NotImplementedError(); + throw new NotSupportedError(); } readdir(_resource: URI): Promise<[string, FileType][]> { - throw new NotImplementedError(); + throw new NotSupportedError(); } mkdir(_resource: URI): Promise { - throw new NotImplementedError(); + throw new NotSupportedError(); } delete(_resource: URI, _opts: FileDeleteOptions): Promise { - throw new NotImplementedError(); + throw new NotSupportedError(); } rename(_from: URI, _to: URI, _opts: FileOverwriteOptions): Promise { - throw new NotImplementedError(); + throw new NotSupportedError(); } }