opencode-feishu 1.0.1 → 1.0.2

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
@@ -112535,15 +112535,35 @@ var CardKitClient = class {
112535
112535
  * 创建 CardKit 2.0 卡片 → cardId
112536
112536
  */
112537
112537
  async createCard(schema) {
112538
- const res = await this.larkClient.cardkit.v1.card.create({
112539
- data: {
112540
- type: "card_json",
112541
- data: JSON.stringify(schema.data)
112538
+ let res;
112539
+ try {
112540
+ res = await this.larkClient.cardkit.v1.card.create({
112541
+ data: {
112542
+ type: "card_json",
112543
+ data: JSON.stringify(schema.data)
112544
+ }
112545
+ });
112546
+ } catch (err) {
112547
+ let detail = "no response body";
112548
+ if (err && typeof err === "object" && "response" in err) {
112549
+ const axiosData = err.response?.data;
112550
+ if (axiosData) {
112551
+ try {
112552
+ detail = JSON.stringify(axiosData);
112553
+ } catch {
112554
+ detail = String(axiosData);
112555
+ }
112556
+ }
112542
112557
  }
112543
- });
112558
+ throw new Error(
112559
+ `CardKit createCard HTTP \u9519\u8BEF: ${err instanceof Error ? err.message : String(err)} | detail: ${detail}`
112560
+ );
112561
+ }
112544
112562
  const cardId = res?.data?.card_id;
112545
112563
  if (!cardId) {
112546
- throw new Error(`CardKit createCard \u5931\u8D25: ${res?.msg ?? "unknown"} (code: ${res?.code})`);
112564
+ throw new Error(
112565
+ `CardKit createCard \u5931\u8D25: ${res?.msg ?? "unknown"} (code: ${res?.code})`
112566
+ );
112547
112567
  }
112548
112568
  return cardId;
112549
112569
  }