(cause: unknown)
| 1578 | * parent are dropped. |
| 1579 | */ |
| 1580 | const formatUnknownMessage = (cause: unknown): string => { |
| 1581 | const messages: string[] = []; |
| 1582 | const seen = new Set<unknown>(); |
| 1583 | let current: unknown = cause; |
| 1584 | while (current !== null && current !== undefined && !seen.has(current)) { |
| 1585 | seen.add(current); |
| 1586 | const message = ownMessage(current); |
| 1587 | if (message.length > 0 && !messages.some((existing) => existing.includes(message))) { |
| 1588 | messages.push(message); |
| 1589 | } |
| 1590 | current = |
| 1591 | typeof current === "object" && "cause" in current |
| 1592 | ? (current as { cause: unknown }).cause |
| 1593 | : undefined; |
| 1594 | } |
| 1595 | if (messages.length === 0) { |
| 1596 | return typeof cause === "string" |
| 1597 | ? cause |
| 1598 | : cause instanceof Error |
| 1599 | ? cause.message |
| 1600 | : String(cause); |
| 1601 | } |
| 1602 | return messages.join("\ncaused by: "); |
| 1603 | }; |
| 1604 | |
| 1605 | const readCliLogLevel = (argv: ReadonlyArray<string>): string | undefined => { |
| 1606 | for (let index = 0; index < argv.length; index += 1) { |
no test coverage detected