(data: unknown)
| 44 | |
| 45 | /** Truncate a JSON-serializable value for debug logging. */ |
| 46 | export function debugBody(data: unknown): string { |
| 47 | const raw = typeof data === 'string' ? data : jsonStringify(data) |
| 48 | const s = redactSecrets(raw) |
| 49 | if (s.length <= DEBUG_MSG_LIMIT) { |
| 50 | return s |
| 51 | } |
| 52 | return s.slice(0, DEBUG_MSG_LIMIT) + `... (${s.length} chars)` |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Extract a descriptive error message from an axios error (or any error). |
no test coverage detected