elbywan / wretch

A tiny wrapper built around fetch with an intuitive syntax. :candy:
MIT License
4.79k stars 96 forks source link

Bug: perfs throws uncatchable error #131

Closed pvampola closed 2 years ago

pvampola commented 2 years ago

Hello,

following code will throw Uncaught (in promise) TypeError: Failed to fetch as well as log 'Error'.

wretch('https://invalidXYZ.com')
    .get()
    .perfs(()=>{})
    .res()
    .catch(()=>console.log('Error'));

If I remove .perfs it will just log 'Error'. I would expect just 'Error' in both cases.

It happens when url is not reachable, the same thing will happen with a working url and disconnected internet.

elbywan commented 2 years ago

Hey @pvampola,

following code will throw Uncaught (in promise) TypeError: Failed to fetch as well as log 'Error'.

Thanks for reporting the issue! 🙇 I just published 📦 v1.7.10 which should include a fix.

elbywan commented 2 years ago

Closing the issue, feel free to reopen is needed.