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/index.js CHANGED
@@ -4488,12 +4488,33 @@ function extractImageKey(response) {
4488
4488
  throw new Error("\u98DE\u4E66\u56FE\u7247\u4E0A\u4F20\u54CD\u5E94\u7F3A\u5C11 image_key\u3002");
4489
4489
  }
4490
4490
  function collectErrorFields(error) {
4491
- const fields = [error];
4492
- const value = error && typeof error === "object" ? error : {};
4493
- fields.push(value.code, value.errorCode, value.msg, value.message);
4494
- const response = value.response && typeof value.response === "object" ? value.response : {};
4495
- const data = response.data && typeof response.data === "object" ? response.data : {};
4496
- fields.push(data.code, data.errorCode, data.msg, data.message);
4491
+ const fields = [];
4492
+ const seen = /* @__PURE__ */ new Set();
4493
+ function visit(value) {
4494
+ if (value === void 0 || value === null || seen.has(value)) {
4495
+ return;
4496
+ }
4497
+ fields.push(value);
4498
+ if (typeof value !== "object") {
4499
+ return;
4500
+ }
4501
+ seen.add(value);
4502
+ if (Array.isArray(value)) {
4503
+ for (const item of value) {
4504
+ visit(item);
4505
+ }
4506
+ return;
4507
+ }
4508
+ const record = value;
4509
+ visit(record.code);
4510
+ visit(record.errorCode);
4511
+ visit(record.msg);
4512
+ visit(record.message);
4513
+ visit(record.error);
4514
+ visit(record.response);
4515
+ visit(record.data);
4516
+ }
4517
+ visit(error);
4497
4518
  return fields;
4498
4519
  }
4499
4520
  function isRichTextCompatibilityError(error) {