@max1874/feishu 0.2.5 → 0.2.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/docx.ts +13 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@max1874/feishu",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "description": "OpenClaw Feishu/Lark channel plugin",
6
6
  "license": "MIT",
package/src/docx.ts CHANGED
@@ -185,12 +185,19 @@ async function insertBlocks(
185
185
  return { children: [], skipped };
186
186
  }
187
187
 
188
- const res = await client.docx.documentBlockChildren.create({
189
- path: { document_id: docToken, block_id: blockId },
190
- data: { children: cleaned },
191
- });
192
- if (res.code !== 0) throw new Error(res.msg);
193
- return { children: res.data?.children ?? [], skipped };
188
+ try {
189
+ const res = await client.docx.documentBlockChildren.create({
190
+ path: { document_id: docToken, block_id: blockId },
191
+ data: { children: cleaned },
192
+ });
193
+ if (res.code !== 0) throw new Error(res.msg);
194
+ return { children: res.data?.children ?? [], skipped };
195
+ } catch (err) {
196
+ // Log block types for debugging
197
+ const blockTypes = cleaned.map((b) => BLOCK_TYPE_NAMES[b.block_type] || `type_${b.block_type}`);
198
+ const errMsg = err instanceof Error ? err.message : String(err);
199
+ throw new Error(`insertBlocks failed: ${errMsg}. Block types: [${blockTypes.join(", ")}]. Count: ${cleaned.length}`);
200
+ }
194
201
  }
195
202
 
196
203
  /** Delete all child blocks from a parent */