fix: OpenRouter showing cline credits error after 402 response (#5590)
* fix: OpenRouter showing cline credits error after 402 response * Create silly-scissors-repair.md
This commit is contained in:
1 parent
9a2aaf0881
commit
385e952935
3 files changed
+8
-2
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
---
|
||||
|
||||
fix: OpenRouter showing cline credits error after 402 response
|
||||
@@ -129,7 +129,7 @@ export class ClineError extends Error {
|
||||
const { code, status, details } = err._error
|
||||
|
||||
// Check balance error first (most specific)
|
||||
if (status === 402 || (code === "insufficient_credits" && typeof details?.current_balance === "number")) {
|
||||
if (code === "insufficient_credits" && typeof details?.current_balance === "number") {
|
||||
return ClineErrorType.Balance
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,11 @@ const ErrorRow = memo(({ message, errorType, apiRequestFailedMessage, apiReqStre
|
||||
case "auto_approval_max_req_reached":
|
||||
// Handle API request errors with special error parsing
|
||||
if (apiRequestFailedMessage || apiReqStreamingFailedMessage) {
|
||||
// FIXME: ClineError parsing should not be applied to non-Cline providers, but it seems we're using clineErrorMessage below in the default error display
|
||||
const clineError = ClineError.parse(apiRequestFailedMessage || apiReqStreamingFailedMessage)
|
||||
const clineErrorMessage = clineError?.message
|
||||
const requestId = clineError?._error?.request_id
|
||||
const isClineProvider = clineError?.providerId === "cline"
|
||||
const isClineProvider = clineError?.providerId === "cline" // FIXME: since we are modifying backend to return generic error, we need to make sure we're not expecting providerId here
|
||||
|
||||
if (clineError) {
|
||||
if (clineError.isErrorType(ClineErrorType.Balance)) {
|
||||
|
||||
Reference in new issue
Block a user