You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I have a fetch wrapper written like this:
importnodeFetch,{FetchError,Response}from"node-fetch";asyncfunctioncustomFetch(...args: Parameters<typeofnodeFetch>){letresponse: Response;try{response=awaitnodeFetch(...args);}catch(error){// throw non-fetch errors furtherif(!(errorinstanceofFetchError)){throwerror;}if(error.type==="system"&&error.errno==="ETIMEDOUT"){// do what there?}thrownewError(`Failed to fetch.`,{cause: error});}returnresponse}
I can't pinpoint the issue for the timeout, it could be the site's fault (although it happens erratically) or something my windows 10 machine not liking about the node server making connections. Or maybe a particular request routing issue at ISP level.
I guess at the very least I'd like to wait and redo the fetch again. But I also would like to run some sort of cleanup in case it's the issue with request inputs or OS connection management, so the next fetch would run with as freshest data as possible.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Let's say I have a fetch wrapper written like this:
I can't pinpoint the issue for the timeout, it could be the site's fault (although it happens erratically) or something my windows 10 machine not liking about the node server making connections. Or maybe a particular request routing issue at ISP level.
I guess at the very least I'd like to wait and redo the fetch again. But I also would like to run some sort of cleanup in case it's the issue with request inputs or OS connection management, so the next fetch would run with as freshest data as possible.
Beta Was this translation helpful? Give feedback.
All reactions