(raw: string)
| 63 | } |
| 64 | |
| 65 | function parseServerError(raw: string): ErrorBody | undefined { |
| 66 | if (raw === '') |
| 67 | return undefined |
| 68 | let parsed: unknown |
| 69 | try { |
| 70 | parsed = JSON.parse(raw) |
| 71 | } |
| 72 | catch { |
| 73 | return undefined |
| 74 | } |
| 75 | const result = zErrorBody.safeParse(parsed) |
| 76 | return result.success ? result.data : undefined |
| 77 | } |
| 78 | |
| 79 | export async function classifyResponse(request: Request, response: Response): Promise<HttpClientError> { |
| 80 | let raw = '' |
no test coverage detected