elbywan / wretch

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

URL information cannot be retrieved during error phase #157

Closed SamyCookie closed 1 year ago

SamyCookie commented 1 year ago

For some reasons I ignore, Response.url is not filled if request failed with an HTTP error code response. For logging purpose at a lot higher level, I get a Wretch Error without the possibility to acess to this information. Does an extra Error.url property could be set there https://github.com/elbywan/wretch/blob/master/src/resolver.ts#L52 ?

elbywan commented 1 year ago

Hey @SamyCookie,

Does an extra Error.url property could be set there https://github.com/elbywan/wretch/blob/master/src/resolver.ts#L52 ?

Sure! I pushed a commit to add the property. It should good with the newly released version 2.3.0.

SamyCookie commented 1 year ago

Perfect ! I test it and it is working perfectly ! Thanks for the adding !