Builds an ApiError from a response and its already-parsed error body --
openapi-fetch decodes JSON before handing you error, so there's no
Response to read a second time. Returns null for a response that
isn't actually an error (status < 400), so callers can call this
unconditionally on openapi-fetch's { data, error, response } result:
Builds an ApiError from a response and its already-parsed error body -- openapi-fetch decodes JSON before handing you
error, so there's noResponseto read a second time. Returns null for a response that isn't actually an error (status < 400), so callers can call this unconditionally on openapi-fetch's{ data, error, response }result:const { data, error, response } = await client.GET("/api/dashboard", {}); const apiErr = decodeError(response, error); if (apiErr) throw apiErr;