not showing request id when insufficient balance (#4953)

* not showing request id when insufficient balance

* whoops

* betterrr
This commit is contained in:
pashpashpash authored and GitHub committed 2025-07-15 21:38:11 -07:00
1 parent 5dddbef65c
commit cef79e06db
4 files changed
+16 -9

No files matched your search

+2 -2
View File
@@ -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",
+1 -2
View File
@@ -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))
}
}
@@ -427,6 +427,10 @@ export const ChatRowContent = memo(
}
if (apiRequestFailedMessage) {
const errorData = parseErrorText(apiRequestFailedMessage)
if (errorData?.code === "insufficient_credits") {
return <span style={{ color: errorColor, fontWeight: "bold" }}>Credit Limit Reached</span>
}
return <span style={{ color: errorColor, fontWeight: "bold" }}>API Request Failed</span>
}
// New: Check for retryStatus to modify the title
@@ -22,10 +22,14 @@ const CreditLimitError: React.FC<CreditLimitErrorProps> = ({
// We have to divide because the balance is stored in microcredits
return (
<div className="p-2 border-none rounded-md mb-2 bg-[var(--vscode-textBlockQuote-background)]">
<div className="mb-2">{message}</div>
<div className="mb-3">
<div className="text-[var(--vscode-foreground)]">
Current Balance: <span className="font-bold">${currentBalance.toFixed(4)}</span>
<div className="mb-3 font-azeret-mono">
<div style={{ color: "var(--vscode-errorForeground)", marginBottom: "8px" }}>{message}</div>
<div style={{ marginBottom: "12px" }}>
<div style={{ color: "var(--vscode-foreground)" }}>
Current Balance: <span style={{ fontWeight: "bold" }}>{currentBalance.toFixed(2)}</span>
</div>
<div style={{ color: "var(--vscode-foreground)" }}>Total Spent: {totalSpent.toFixed(2)}</div>
<div style={{ color: "var(--vscode-foreground)" }}>Total Promotions: {totalPromotions.toFixed(2)}</div>
</div>
</div>
@@ -35,7 +39,7 @@ const CreditLimitError: React.FC<CreditLimitErrorProps> = ({
width: "100%",
marginBottom: "8px",
}}>
<span className="codicon codicon-credit-card mr-0.5 text-sm" />
<span className="codicon codicon-credit-card mr-[6px] text-[14px]" />
Buy Credits
</VSCodeButtonLink>