Skip to content
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/http: wrap more errors? #36713

Open
josharian opened this issue Jan 23, 2020 · 2 comments
Open

net/http: wrap more errors? #36713

josharian opened this issue Jan 23, 2020 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@josharian
Copy link
Contributor

While trying to understand some net/http errors, I found that many net/http errors don't wrap their underlying errors yet (run grep -R "fmt.Errorf.*%v" net/http to see some).

@bradfitz are you open to making the default be to wrap errors in net/http? That is, can someone do a somewhat indiscriminate pass through net/http, wrapping errors everywhere they see an opportunity to do so?

@josharian josharian changed the title net/http: wrap more errors net/http: wrap more errors? Jan 23, 2020
@toothrot toothrot added this to the Backlog milestone Jan 23, 2020
@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 23, 2020
@bukowa
Copy link

bukowa commented Feb 9, 2020

For example

return nil, fmt.Errorf("net/http: invalid method %q", req.Method)

return nil, fmt.Errorf("net/http: invalid method %q", method)

err = errors.New("net/http: server replied with more than declared Content-Length; truncated")

There's also Get http://X.com: dial tcp: lookup X.com: getaddrinfow: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server. that i cannot find in the lib.

@gopherbot
Copy link

Change https://golang.org/cl/288295 mentions this issue: net/http: indiscriminately wrap errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants