From c2dd1df67a87f4a4d2143b6611ba5fd6363dc400 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 11 Feb 2025 10:32:23 -0800 Subject: [PATCH] add error handling for missing transformers file' --- core/core.ts | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/core/core.ts b/core/core.ts index 4b5e07b81..210c7f490 100644 --- a/core/core.ts +++ b/core/core.ts @@ -413,10 +413,35 @@ export class Core { id, })); } catch (e) { - void this.ide.showToast( - "error", - `Error getting context items from ${name}: ${e}`, - ); + let knownError = false; + + if (e instanceof Error) { + // A specific error where we're forcing the presence of embeddings provider on the config + // But Jetbrains doesn't support transformers JS + // So if a context provider needs it it will throw this error when the file isn't found + if (e.message.includes("all-MiniLM-L6-v2")) { + const toastOption = "See Docs"; + void this.ide + .showToast( + "error", + `Set up an embeddings model to use ${name}`, + toastOption, + ) + .then((userSelection) => { + if (userSelection === toastOption) { + void this.ide.openUrl( + "https://docs.continue.dev/customize/model-types/embeddings", + ); + } + }); + } + } + if (!knownError) { + void this.ide.showToast( + "error", + `Error getting context items from ${name}: ${e}`, + ); + } return []; } });