@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.
- package/package.json +1 -1
- package/src/docx.ts +13 -6
package/package.json
CHANGED
package/src/docx.ts
CHANGED
|
@@ -185,12 +185,19 @@ async function insertBlocks(
|
|
|
185
185
|
return { children: [], skipped };
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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 */
|