From 8f40589c6dd784297754b74cf9cd5b7d39823310 Mon Sep 17 00:00:00 2001 From: Barrca <60709314+FBarrca@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:04:09 -0800 Subject: [PATCH] Add type any to the errors --- src/api.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api.ts b/src/api.ts index c7a0fb1..9d87d48 100644 --- a/src/api.ts +++ b/src/api.ts @@ -70,7 +70,7 @@ export class ChatApiManager { new Notice(`⚠️ Unsupported provider: ${settings.provider}`); return null; } - } catch (error) { + } catch (error: any) { console.error("Error initializing chat client:", error); new Notice(`❌ Error initializing chat client: ${error.message}`); return null; @@ -97,7 +97,7 @@ export class ChatApiManager { try { const aiMessage: AIMessage = await this.chatClient.invoke(messages); return aiMessage.content.toString(); - } catch (error) { + } catch (error: any) { console.error("Error calling the chat model:", error); new Notice(`❌ Error calling the chat model: ${error.message}`); return "⚠️ Failed to generate a response. Please try again later."; @@ -127,7 +127,7 @@ export class ChatApiManager { }); return response; - } catch (error) { + } catch (error: any) { console.error("Error processing request:", error); new Notice(`❌ Error processing request: ${error.message}`); return "⚠️ Failed to process request."; @@ -160,7 +160,7 @@ export class ChatApiManager { const systemPrompt = isCursor ? this.settings.cursorPrompt : this.settings.selectionPrompt; let userPrompt = ``; - + if (isCursor) { userPrompt = ` **Task:** ${prompt} @@ -173,7 +173,7 @@ export class ChatApiManager { **Output:**`; } - return this.handleEditorUpdate(systemPrompt, userPrompt); + return this.handleEditorUpdate(systemPrompt, userPrompt); } /**