(value: unknown)
| 926 | } |
| 927 | |
| 928 | function formatDetailValue(value: unknown): string { |
| 929 | if (value instanceof Error) { |
| 930 | // A stack already starts with "Name: message" and carries the frames the |
| 931 | // plain name/message would throw away, so prefer it when present. |
| 932 | if (typeof value.stack === 'string' && value.stack) return value.stack; |
| 933 | return value.message ? `${value.name}: ${value.message}` : value.name; |
| 934 | } |
| 935 | if (typeof value === 'string') return value; |
| 936 | if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') { |
| 937 | return String(value); |
| 938 | } |
| 939 | try { |
| 940 | return JSON.stringify(value); |
| 941 | } catch { |
| 942 | return String(value); |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | function errorName(err: unknown): string | undefined { |
| 947 | return err instanceof Error |
no outgoing calls
no test coverage detected