toErrorResponse
toErrorResponse(
response,fallbackCode):AuthResponse<never>
Defined in: packages/auth/src/errors/toErrorResponse.ts:20
Convert a RestClient response into an error-shaped AuthResponse.
Three cases, in priority order:
- Body is the normalized
APIResponseshape withisErr: true— maperrorCodevia mapBackendErrorCode; if no specific mapping is found, fall back to the caller-suppliedfallbackCodeso each call site stays in control of its default failure code. - apisauce flagged a transport
problem(timeout / network / connection error) — returnAUTH_NETWORK_ERROR. HTTP 401 falls through toAUTH_UNAUTHORIZED. - Anything else — fall back to the caller-supplied
fallbackCode.
Parameters
Section titled “Parameters”response
Section titled “response”RestResponse<unknown>
fallbackCode
Section titled “fallbackCode”Returns
Section titled “Returns”AuthResponse<never>