From cef79e06db033092d4797a370ded0a3f8a6c3f8c Mon Sep 17 00:00:00 2001 From: pashpashpash Date: Tue, 15 Jul 2025 21:38:11 -0700 Subject: [PATCH] not showing request id when insufficient balance (#4953) * not showing request id when insufficient balance * whoops * betterrr --- package-lock.json | 4 ++-- src/api/providers/cline.ts | 3 +-- webview-ui/src/components/chat/ChatRow.tsx | 4 ++++ .../src/components/chat/CreditLimitError.tsx | 14 +++++++++----- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 94600555..b309cddd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "claude-dev", - "version": "3.18.14", + "version": "3.19.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "claude-dev", - "version": "3.18.14", + "version": "3.19.4", "license": "Apache-2.0", "dependencies": { "@anthropic-ai/sdk": "^0.37.0", diff --git a/src/api/providers/cline.ts b/src/api/providers/cline.ts index 9042deda..75d4918c 100644 --- a/src/api/providers/cline.ts +++ b/src/api/providers/cline.ts @@ -179,12 +179,11 @@ export class ClineHandler implements ApiHandler { } } catch (error) { console.error("Cline API Error:", error) - const requestId = error?.request_id ? ` (Request ID: ${error.request_id})` : "" + const requestId = error?.request_id ? `\n | Request ID: ${error.request_id}` : "" if (error.code === "ERR_BAD_REQUEST" || error.status === 401) { throw new Error(CLINE_ACCOUNT_AUTH_ERROR_MESSAGE + requestId) } else if (error.code === "insufficient_credits" || error.status === 402) { if (error.error) { - error.error.message = error.error.message + requestId throw new Error(JSON.stringify(error.error)) } } diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 42379d6a..2978b72c 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -427,6 +427,10 @@ export const ChatRowContent = memo( } if (apiRequestFailedMessage) { + const errorData = parseErrorText(apiRequestFailedMessage) + if (errorData?.code === "insufficient_credits") { + return Credit Limit Reached + } return API Request Failed } // New: Check for retryStatus to modify the title diff --git a/webview-ui/src/components/chat/CreditLimitError.tsx b/webview-ui/src/components/chat/CreditLimitError.tsx index e2d09acd..3f0adf05 100644 --- a/webview-ui/src/components/chat/CreditLimitError.tsx +++ b/webview-ui/src/components/chat/CreditLimitError.tsx @@ -22,10 +22,14 @@ const CreditLimitError: React.FC = ({ // We have to divide because the balance is stored in microcredits return (
-
{message}
-
-
- Current Balance: ${currentBalance.toFixed(4)} +
+
{message}
+
+
+ Current Balance: {currentBalance.toFixed(2)} +
+
Total Spent: {totalSpent.toFixed(2)}
+
Total Promotions: {totalPromotions.toFixed(2)}
@@ -35,7 +39,7 @@ const CreditLimitError: React.FC = ({ width: "100%", marginBottom: "8px", }}> - + Buy Credits