MCPcopy Create free account
hub / github.com/tiann/hapi / apiValidationError

Function apiValidationError

cli/src/utils/errorUtils.ts:20–30  ·  view source on GitHub ↗
(message: string, response: AxiosResponse)

Source from the content-addressed store, hash-verified

18 * Attaches the protocol version header so callers can detect version mismatch.
19 */
20export 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

Callers 8

errorUtils.test.tsFile · 0.90
runMethod · 0.90
getOrCreateSessionMethod · 0.90
getSessionMethod · 0.90
getOrCreateMachineMethod · 0.90
listResumableSessionsMethod · 0.90
getLocalResumeTargetMethod · 0.90
handoffSessionToLocalMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected