ofetch icon indicating copy to clipboard operation
ofetch copied to clipboard

Transform globally response when error occurs

Open tiagomatosweb opened this issue 3 years ago • 1 comments

Hi all, I'm creating a new instance of $fetch and I am adding onResponseError interceptor to try to transform the response data when error occurs.

I want to send the error payload already transformed from the interceptor so that when I use .catch it get the error already transformed.

But i couldn't make it happen. Any changes that I make within onResponseError method doesn't replicate to .catch

Any tricks?

tiagomatosweb avatar Jun 22 '22 18:06 tiagomatosweb

@tiagomatosweb

I'm not 100% sure what you want to achieve, and according to the date you created this issue, I guess you tried it with ohfetch v0.4.18 at most.

I appreciate if you provide more information (e.g. code sample), so that we could understand what your needs.

Especially, I'm not sure what the sentence below means:

I want to send the error payload already transformed from the interceptor so that when I use .catch it get the error already transformed.

Where do you want to send in the interceptor?

nozomuikuta avatar Jan 11 '23 20:01 nozomuikuta

closing due to inactivity.

pi0 avatar Aug 28 '24 10:08 pi0