(value: unknown, maxLength = 500)
| 1 | export function formatValueForError(value: unknown, maxLength = 500): string { |
| 2 | const jsonStr = JSON.stringify(value, null, 2) ?? 'undefined' |
| 3 | const truncated = jsonStr.length > maxLength |
| 4 | ? jsonStr.slice(0, maxLength) + '...(truncated)' |
| 5 | : jsonStr |
| 6 | if (value === null || value === undefined || typeof value !== 'object') { |
| 7 | return `${truncated} (type: ${value === null ? 'null' : typeof value})` |
| 8 | } |
| 9 | return truncated |
| 10 | } |
no outgoing calls
no test coverage detected