-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/url: url.Error should propagate the net.Error interface #12866
Comments
/cc @bradfitz |
Sure. If somebody wants to send a CL to make |
I'll take a shot |
@jum I started to look into this, and I cannot find a place where url.Error.Err is assigned something that conforms to net.Error. I think there is nothing to do on this ticket because url.Error never wraps a net.Error. Can you please provide some sample code that shows a url.Error holding a net.Error. Thanks Dave |
@jum sorry, I found it. There is one place in http/client.go, https://github.com/golang/go/blob/master/src/net/http/client.go#L417, where url.Error is used to record the url that failed in a redirect chain. |
CL https://golang.org/cl/15672 mentions this issue. |
I just wasted way more than 15 minutes trying to figure out why some network error was not catch by |
@arvenil, there is a separate bug open for that. I don't know its number off hand, though. |
At some points in a program it might interesting to find out if a network error is transient or a timeout. If the program uses Dial et. al. this is handled by calling the Temporary() or Timeout() interfaces on net.Error. But if the program uses http.Get or similar, the net.Error is hidden behind url.Error.Err. one has to use a logic like this check for transient errors:
If url.Error would embed Err anonymously, any interfaces would be available without the type assertion to *url.Error.
The text was updated successfully, but these errors were encountered: