fix: improve error property extraction from nested response objects (#7669)

- Remove intermediate response extraction to preserve full error structure
- Add fallback to error.response.message and error.response.status
- Stringify error object in logException for better console output
This commit is contained in:
Bee authored and GitHub committed 2025-11-25 10:58:55 -08:00
1 parent c15287ace0
commit e22c457d19
2 files changed
+4 -5

No files matched your search

+3 -4
View File
@@ -56,14 +56,13 @@ export class ClineError extends Error {
public readonly modelId?: string,
public readonly providerId?: string,
) {
const serialized = serializeError(raw)
const error = serialized?.response || serialized
const error = serializeError(raw)
const message = error.message || String(error) || error?.cause?.means
const message = error.message || error?.response?.message || String(error) || error?.cause?.means
super(message)
// Extract status from multiple possible locations
const status = error.status || error.statusCode
const status = error.status || error.statusCode || error.response?.status
this.modelId = modelId || error.modelId
this.providerId = providerId || error.providerId
+1 -1
View File
@@ -41,7 +41,7 @@ export class ErrorService {
public logException(error: Error | ClineError, properties?: Record<string, unknown>): void {
this.provider.logException(error, properties)
console.error("[ErrorService] Logging exception", error)
console.error("[ErrorService] Logging exception", JSON.stringify(error))
}
public logMessage(