chattercatcher 0.2.3 → 0.2.4

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/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import fs15 from "fs/promises";
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "chattercatcher",
11
- version: "0.2.3",
11
+ version: "0.2.4",
12
12
  description: "\u672C\u5730\u4F18\u5148\u7684\u98DE\u4E66/Lark \u5BB6\u5EAD\u7FA4\u77E5\u8BC6\u5E93\u673A\u5668\u4EBA",
13
13
  type: "module",
14
14
  main: "dist/index.js",
@@ -4633,12 +4633,33 @@ function extractImageKey(response) {
4633
4633
  throw new Error("\u98DE\u4E66\u56FE\u7247\u4E0A\u4F20\u54CD\u5E94\u7F3A\u5C11 image_key\u3002");
4634
4634
  }
4635
4635
  function collectErrorFields(error) {
4636
- const fields = [error];
4637
- const value = error && typeof error === "object" ? error : {};
4638
- fields.push(value.code, value.errorCode, value.msg, value.message);
4639
- const response = value.response && typeof value.response === "object" ? value.response : {};
4640
- const data2 = response.data && typeof response.data === "object" ? response.data : {};
4641
- fields.push(data2.code, data2.errorCode, data2.msg, data2.message);
4636
+ const fields = [];
4637
+ const seen = /* @__PURE__ */ new Set();
4638
+ function visit(value) {
4639
+ if (value === void 0 || value === null || seen.has(value)) {
4640
+ return;
4641
+ }
4642
+ fields.push(value);
4643
+ if (typeof value !== "object") {
4644
+ return;
4645
+ }
4646
+ seen.add(value);
4647
+ if (Array.isArray(value)) {
4648
+ for (const item of value) {
4649
+ visit(item);
4650
+ }
4651
+ return;
4652
+ }
4653
+ const record = value;
4654
+ visit(record.code);
4655
+ visit(record.errorCode);
4656
+ visit(record.msg);
4657
+ visit(record.message);
4658
+ visit(record.error);
4659
+ visit(record.response);
4660
+ visit(record.data);
4661
+ }
4662
+ visit(error);
4642
4663
  return fields;
4643
4664
  }
4644
4665
  function isRichTextCompatibilityError(error) {