@hcmai/sdk 0.3.12 → 0.3.13
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 +14 -0
- package/dist/index.js.map +1 -1
- package/package.json +9 -5
package/dist/index.js
CHANGED
|
@@ -592,6 +592,11 @@ var CliError = class extends Error {
|
|
|
592
592
|
const detailText = formatDetails(details);
|
|
593
593
|
if (detailText) out += `
|
|
594
594
|
\u8BE6\u60C5: ${detailText}`;
|
|
595
|
+
if (!detailText) {
|
|
596
|
+
const causeText = formatCause(this.cause);
|
|
597
|
+
if (causeText) out += `
|
|
598
|
+
\u539F\u56E0: ${causeText}`;
|
|
599
|
+
}
|
|
595
600
|
const nextStep = this.context?.nextStep;
|
|
596
601
|
if (typeof nextStep === "string" && nextStep) out += `
|
|
597
602
|
\u4E0B\u4E00\u6B65: ${nextStep}`;
|
|
@@ -657,6 +662,15 @@ function formatDetails(details) {
|
|
|
657
662
|
if (!text || text === "{}" || text === "[]") return void 0;
|
|
658
663
|
return text.length > 800 ? `${text.slice(0, 800)}\u2026\uFF08\u5DF2\u622A\u65AD\uFF09` : text;
|
|
659
664
|
}
|
|
665
|
+
function formatCause(cause) {
|
|
666
|
+
if (!cause) return void 0;
|
|
667
|
+
if (typeof cause === "string") return cause.trim().slice(0, 300) || void 0;
|
|
668
|
+
if (cause instanceof Error) {
|
|
669
|
+
const text = cause.message?.trim();
|
|
670
|
+
return text ? text.slice(0, 300) : void 0;
|
|
671
|
+
}
|
|
672
|
+
return void 0;
|
|
673
|
+
}
|
|
660
674
|
|
|
661
675
|
// src/config/env.ts
|
|
662
676
|
async function saveEnv(name, cfg) {
|