uv icon indicating copy to clipboard operation
uv copied to clipboard

Always attach URL to network errors

Open konstin opened this issue 1 year ago • 3 comments

Due to the enduring problems with #8144 and related issues, I've opted for a more systemic approach and switched all reqwest errors to not use the implicit-try-fallthrough #[from], but an explicit #[source] with a URL attached (except for when there is only one or no URL). This guarantees that we get the URL that failed, and helps identifying the responsible code path.

konstin avatar Oct 22 '24 10:10 konstin

It's a bit of a bummer that in all the snapshot changes here we just end up repeating the URL.

zanieb avatar Oct 22 '24 11:10 zanieb

I'd prefer it if reqwest would always include the URL or otherwise have a switch to turn the optional URL off from duplication in error display, but lacking that it's better to repeat the URL than to end up with errors like https://github.com/astral-sh/uv/issues/8144#issuecomment-2426912260 that we can't trace anymore.

konstin avatar Oct 22 '24 11:10 konstin

Could we only attach for certain error kinds?

charliermarsh avatar Oct 22 '24 13:10 charliermarsh

For just the reqwest error messages and given the opaque reqwest error type, it doesn't make sense to optimize this too much, so we accept the slight regression in the error trace for being able to fix bugs like #8144 and ensuring that we show the user the error URL.

konstin avatar Oct 25 '24 07:10 konstin