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