(cause: unknown)
| 1591 | * parent are dropped. |
| 1592 | */ |
| 1593 | const formatUnknownMessage = (cause: unknown): string => { |
| 1594 | const messages: string[] = []; |
| 1595 | const seen = new Set<unknown>(); |
| 1596 | let current: unknown = cause; |
| 1597 | while (current !== null && current !== undefined && !seen.has(current)) { |
| 1598 | seen.add(current); |
| 1599 | const message = ownMessage(current); |
| 1600 | if (message.length > 0 && !messages.some((existing) => existing.includes(message))) { |
| 1601 | messages.push(message); |
| 1602 | } |
| 1603 | current = |
| 1604 | typeof current === "object" && "cause" in current |
| 1605 | ? (current as { cause: unknown }).cause |
| 1606 | : undefined; |
| 1607 | } |
| 1608 | if (messages.length === 0) { |
| 1609 | return typeof cause === "string" |
| 1610 | ? cause |
| 1611 | : cause instanceof Error |
| 1612 | ? cause.message |
| 1613 | : String(cause); |
| 1614 | } |
| 1615 | return messages.join("\ncaused by: "); |
| 1616 | }; |
| 1617 | |
| 1618 | const readCliLogLevel = (argv: ReadonlyArray<string>): string | undefined => { |
| 1619 | for (let index = 0; index < argv.length; index += 1) { |
no test coverage detected