claw-subagent-service 0.0.106 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claw-subagent-service",
3
- "version": "0.0.106",
3
+ "version": "0.0.107",
4
4
  "description": "虾说智能助手",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -392,10 +392,14 @@ class OpenClawClient {
392
392
  // 打印详细错误响应
393
393
  if (err.response) {
394
394
  this.log?.error(`[OpenClawClient] 错误状态码: ${err.response.status}`);
395
- try {
396
- this.log?.error(`[OpenClawClient] 错误响应数据: ${JSON.stringify(err.response.data)}`);
397
- } catch (e) {
398
- this.log?.error(`[OpenClawClient] 错误响应数据(无法JSON序列化): ${require('util').inspect(err.response.data, {depth: 2})}`);
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}`);
399
403
  }
400
404
  }
401
405
  }