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:
2 files changed
+4
-5
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user