claw-subagent-service 0.0.105 → 0.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -392,7 +392,15 @@ class OpenClawClient {
|
|
|
392
392
|
// 打印详细错误响应
|
|
393
393
|
if (err.response) {
|
|
394
394
|
this.log?.error(`[OpenClawClient] 错误状态码: ${err.response.status}`);
|
|
395
|
-
|
|
395
|
+
// 安全地提取错误信息
|
|
396
|
+
const errorData = err.response.data;
|
|
397
|
+
if (typeof errorData === 'string') {
|
|
398
|
+
this.log?.error(`[OpenClawClient] 错误响应: ${errorData}`);
|
|
399
|
+
} else if (errorData && typeof errorData === 'object') {
|
|
400
|
+
// 提取常见错误字段
|
|
401
|
+
const errorMsg = errorData.error?.message || errorData.message || errorData.error || JSON.stringify(errorData);
|
|
402
|
+
this.log?.error(`[OpenClawClient] 错误响应: ${errorMsg}`);
|
|
403
|
+
}
|
|
396
404
|
}
|
|
397
405
|
}
|
|
398
406
|
// 不再内部调用 onError,让错误通过 Promise reject 向上传播,便于调用方回退
|