MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / formatUnknownMessage

Function formatUnknownMessage

apps/cli/src/main.ts:1603–1626  ·  view source on GitHub ↗
(cause: unknown)

Source from the content-addressed store, hash-verified

1601 * parent are dropped.
1602 */
1603const formatUnknownMessage = (cause: unknown): string => {
1604 const messages: string[] = [];
1605 const seen = new Set<unknown>();
1606 let current: unknown = cause;
1607 while (current !== null && current !== undefined && !seen.has(current)) {
1608 seen.add(current);
1609 const message = ownMessage(current);
1610 if (message.length > 0 && !messages.some((existing) => existing.includes(message))) {
1611 messages.push(message);
1612 }
1613 current =
1614 typeof current === "object" && "cause" in current
1615 ? (current as { cause: unknown }).cause
1616 : undefined;
1617 }
1618 if (messages.length === 0) {
1619 return typeof cause === "string"
1620 ? cause
1621 : cause instanceof Error
1622 ? cause.message
1623 : String(cause);
1624 }
1625 return messages.join("\ncaused by: ");
1626};
1627
1628const readCliLogLevel = (argv: ReadonlyArray<string>): string | undefined => {
1629 for (let index = 0; index < argv.length; index += 1) {

Callers 1

renderCliErrorFunction · 0.85

Calls 2

ownMessageFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected