Closed
Description
I just reviewed a PR with the line case err.Error() == "http: can't write HTTP request on broken connection"
. That's brittle code, and it's hard to test in a way that ensures it stays in sync with any changes to the error message wording in net/http--but there's no way to improve upon it given the errors the http package emits.
Possible improments:
- net/http could predeclare its errors
- or make a custom error type
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.)