Open jfsiii opened 1 year ago
I think the handleError stuff can be made a plugin as well, I think that makes sense. Would you be willing to make a pr?
Actually, thinking more on this, instead of throwing with only the statustext, cant we just throw with the entire response object?
I want to a) not throw an error when
!response.ok
b) have full access to theResponse
(statusText
,body
,headers
) etce.g. given
I'd like
response
to always be aResponse
regardless of what HTTP status code was returned. Is this possible?(a) seems to be addressed by
handleError
but I cannot figure out how to achieve (b). I've tried every combination ofhandleError
,afterFetch
, etc I can think of but I can never seem to get the body of an error response back (e.g. if/endpoint
returns a 4xx.Looking at the code, the issue seems to be that
.then(handleStatus)
is always called. AndhandleStatus
converts thatResponse
to anError
, losing all the info from theResponse
Do I have that correct? Either way, can you suggest any way to achieve what I'm describing?
Edit: I now see that getting the
Response
would be a bigger change than skippinghandleStatus
. IIUC, skippinghandleStatus
would allow access to the processed body though