From c67ca4da0738b61ec95c0b0b58c27dc28dd821ea Mon Sep 17 00:00:00 2001 From: Amiram Wingarten Date: Mon, 1 Mar 2021 11:14:28 +0200 Subject: [PATCH] replace throw with warning on storage set with no workspace The functionality is not expected to work according to API, however it doesn't fail in VS Code Signed-off-by: Amiram Wingarten --- packages/plugin-ext/src/main/node/plugins-key-value-storage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/plugin-ext/src/main/node/plugins-key-value-storage.ts b/packages/plugin-ext/src/main/node/plugins-key-value-storage.ts index e52bde12afb93..e3710fc05810c 100644 --- a/packages/plugin-ext/src/main/node/plugins-key-value-storage.ts +++ b/packages/plugin-ext/src/main/node/plugins-key-value-storage.ts @@ -56,7 +56,8 @@ export class PluginsKeyValueStorage { async set(key: string, value: KeysToAnyValues, kind: PluginStorageKind): Promise { const dataPath = await this.getDataPath(kind); if (!dataPath) { - throw new Error('Cannot save data: no opened workspace'); + console.warn('Cannot save data: no opened workspace'); + return false; } const data = await this.readFromFile(dataPath);