Skip to content

Function: fromHttpResponse()

Function: fromHttpResponse()

fromHttpResponse(status, body): AuthError

Defined in: auth-client/src/core/errors.ts:148

Map an HTTP response from the auth-server into the right AuthError subclass. Centralizes the status→class lookup so every flow uses the same mapping.

The server’s error envelope looks like: { error: { code: “INVALID_CREDENTIALS”, message: ”…”, status: 401 } }

We extract code and message defensively — if the body isn’t the expected shape, we fall back to the HTTP status text.

Parameters

status

number

body

unknown

Returns

AuthError