(cause: unknown)
| 1559 | * parent are dropped. |
| 1560 | */ |
| 1561 | const formatUnknownMessage = (cause: unknown): string => { |
| 1562 | const messages: string[] = []; |
| 1563 | const seen = new Set<unknown>(); |
| 1564 | let current: unknown = cause; |
| 1565 | while (current !== null && current !== undefined && !seen.has(current)) { |
| 1566 | seen.add(current); |
| 1567 | const message = ownMessage(current); |
| 1568 | if (message.length > 0 && !messages.some((existing) => existing.includes(message))) { |
| 1569 | messages.push(message); |
| 1570 | } |
| 1571 | current = |
| 1572 | typeof current === "object" && "cause" in current |
| 1573 | ? (current as { cause: unknown }).cause |
| 1574 | : undefined; |
| 1575 | } |
| 1576 | if (messages.length === 0) { |
| 1577 | return typeof cause === "string" |
| 1578 | ? cause |
| 1579 | : cause instanceof Error |
| 1580 | ? cause.message |
| 1581 | : String(cause); |
| 1582 | } |
| 1583 | return messages.join("\ncaused by: "); |
| 1584 | }; |
| 1585 | |
| 1586 | const readCliLogLevel = (argv: ReadonlyArray<string>): string | undefined => { |
| 1587 | for (let index = 0; index < argv.length; index += 1) { |
no test coverage detected