Major Changes
-
0f9dc36: Throw
HonoResponseErroron non-2xx responses.queryFnandmutationFnresolved with whateverres.json()returned, so a 4xx was cached as successful data and a failed mutation ranonSuccess. Error bodies that were not json threw a bareSyntaxErrorwith no status attached, and 204 responses failed to parse at all.Non-2xx responses now reject with
HonoResponseError, carrying the status, the parsed body and the original response. Query data is narrowed to the endpoint's success statuses, and 204/205 responses resolve tonull.To migrate:
- Failure checks on
data(if ('error' in data),Array.isArray(data)) becomeerror instanceof HonoResponseError, and the payload moves toerror.data. - Failed mutations run
onErrorinstead ofonSuccess. - 4xx responses are now retried by default; set a retry predicate on your
QueryClientto skip them.
- Failure checks on