From e22c457d19cb5ebee5ebe5886f86fbaa061937f9 Mon Sep 17 00:00:00 2001 From: Bee <68532117+abeatrix@users.noreply.github.com> Date: Tue, 25 Nov 2025 10:58:55 -0800 Subject: [PATCH] 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 --- src/services/error/ClineError.ts | 7 +++---- src/services/error/ErrorService.ts | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/services/error/ClineError.ts b/src/services/error/ClineError.ts index 998e36e1..e6170d2d 100644 --- a/src/services/error/ClineError.ts +++ b/src/services/error/ClineError.ts @@ -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 diff --git a/src/services/error/ErrorService.ts b/src/services/error/ErrorService.ts index 57f61d1c..ecc5e995 100644 --- a/src/services/error/ErrorService.ts +++ b/src/services/error/ErrorService.ts @@ -41,7 +41,7 @@ export class ErrorService { public logException(error: Error | ClineError, properties?: Record): void { this.provider.logException(error, properties) - console.error("[ErrorService] Logging exception", error) + console.error("[ErrorService] Logging exception", JSON.stringify(error)) } public logMessage(