Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: error messages are not introspectable #9383
I just reviewed a PR with the line
Any mechanism is fine as long as it lets the compiler check that people are referring to the error they intend to.
(I realize this is probably low priority.)
referenced this issue
Dec 18, 2014
The underlying error was #3514
EDIT: Updated, the error was similar to 3514.
Scenario is a go http.Client talking to a go http.Server with
I will create a reduced repro case for the actual 'http: can't write HTTP request'
It looks like we should be using the same
I have a patch for
Yes, I was the one who wrote the string comparison code and lavalamp was the reviewer. I was providing the example in case there was disagreement whether normal use of net/http would replicate the error such that it deserved a distinct type, which it sounds like there was not.
If I were king, I would make these rules for library writers:
Breaking either rule makes it pretty much impossible for library consumers to correctly handle errors.