utilful 3.5.0 → 3.5.1
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/cli/errors.mjs +7 -1
- package/package.json +1 -1
package/dist/cli/errors.mjs
CHANGED
|
@@ -32,10 +32,16 @@ function isExpected(error, expectedErrors) {
|
|
|
32
32
|
function formatCauseChain(error, message) {
|
|
33
33
|
const causeLines = [];
|
|
34
34
|
const seen = /* @__PURE__ */ new Set([error]);
|
|
35
|
+
let printedText = message;
|
|
35
36
|
let current = error instanceof Error ? error.cause : void 0;
|
|
36
37
|
while (current instanceof Error && !seen.has(current)) {
|
|
37
38
|
seen.add(current);
|
|
38
|
-
|
|
39
|
+
const name = current.name || "Error";
|
|
40
|
+
if (!current.message) causeLines.push(`Caused by: ${name}`);
|
|
41
|
+
else if (!printedText.includes(current.message)) {
|
|
42
|
+
causeLines.push(`Caused by: ${name}: ${current.message}`);
|
|
43
|
+
printedText += `\n${current.message}`;
|
|
44
|
+
}
|
|
39
45
|
current = current.cause;
|
|
40
46
|
}
|
|
41
47
|
return causeLines.join("\n");
|
package/package.json
CHANGED