(message: string, response: AxiosResponse)
| 18 | * Attaches the protocol version header so callers can detect version mismatch. |
| 19 | */ |
| 20 | export function apiValidationError(message: string, response: AxiosResponse): Error { |
| 21 | const err = new Error(message) |
| 22 | const raw = response.headers?.['x-hapi-protocol-version'] |
| 23 | if (raw != null) { |
| 24 | const pv = Number(raw) |
| 25 | if (Number.isFinite(pv)) { |
| 26 | ;(err as unknown as Record<string, unknown>).serverProtocolVersion = pv |
| 27 | } |
| 28 | } |
| 29 | return err |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Extract structured error information from an unknown error |
no outgoing calls
no test coverage detected